Topic: Why no "alignof unary-expression" like "sizeof unary-expression"?


Author: Keith Thompson<kst-u@mib.org>
Date: Fri, 17 Jun 2011 13:15:39 CST
Raw View
The new alignof operator is followed by a parenthesized type-id,
similar to the existing syntax for sizeof.  But unlike sizeof,
it can't be applied to a unary-expression.  Why the restriction?

(N1971, which appears to be the original proposal for alignof,
shows a form "alignof ( constant-expression )", which apparently
just yields the value of the expression (I haven't figured out why
this would be useful).  If that had survived, it could conflict with
"alignof unary-expression".  Is that the reason?)

--
Keith Thompson (The_Other_Keith) kst-u@mib.org<http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
     -- Antony Jay and Jonathan Lynn, "Yes Minister"


[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]