comp.lang.c
[Top] [All Lists]

Re: sizeof(x)

Subject: Re: sizeofx
From: Ioannis Vranos
Date: Sun, 30 Mar 2008 23:07:05 +0300
Newsgroups: comp.lang.c

Harald van Dijk wrote:
> On Sun, 30 Mar 2008 22:50:00 +0300, Ioannis Vranos wrote:
>> In C99 it is mentioned:
>>
>> "The sizeof operator yields the size (in bytes) of its operand, which
>> may be an expression or the parenthesized name of a type.".
>>
>> If I am not wrong, this implies that
>>
>> int x;
>>
>> size_t y= sizeof(x);
>>
>>
>> is not valid.
> 
> You are; (x) is a perfectly valid expression, so there's no problem 
> taking the size of (x).


I first saw that only sizeof x is valid at the pdf hosted at
http://cprog.tomsweb.net.

Then I checked the C99 standard and it mentions what is shown above.
Clearly C99 doesn't mention parenthesized expression.

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy