[cfe-dev] sizeof(sizeof(...))

Ted Kremenek kremenek at apple.com
Fri Dec 14 14:41:13 PST 2007

On Dec 14, 2007, at 2:36 PM, Oliver Hunt wrote:

> On 14/12/2007, at 2:21 PM, Bill Wendling wrote:
>> Well, the standard says to "integer" type, so probably not unsigned.
>> But that's my understanding of it. Though I don't believe that sizeof
>> should be evaluating the expression...
> Indeed, my understanding was that sizeof expr merely evaluated the  
> type of the expression, not the expression itself.

Not always with VLAs.  From the C99 standard (

The sizeof operator yields the size (in bytes) of its operand, which  
may be an
expression or the parenthesized name of a type. The size is determined  
from the type of
the operand. The result is an integer. If the type of the operand is a  
variable length array
type, the operand is evaluated; otherwise, the operand is not  
evaluated and the result is an
integer constant.

More information about the cfe-dev mailing list