Re: The act of sizeof(++i) ?
- From: "Frederick Ding" <me@xxxxxxxxxxx>
- Date: Wed, 7 Dec 2005 18:41:35 +0800
Thanks, It is the C++ standard. Is that the same in C(C89/C99)?
"Alex Blekhman" <tkfx.N05P4M@xxxxxxxxx>
> Frederick Ding wrote:
>> Hi,
>> I have a problem:
>>
>> int i = 0, j = 0;
>> j = sizeof(++i);
>> printf("i = %d j = %d\n", i, j);
>>
>> Output: 0 4
>> ¡¡ I wonder why i didn't increase itself?
>
> From C++ Standard, 5.3.3/1:
> -------
> The sizeof operator yields the number of bytes in the object
> representation of its operand. The operand is either an expression, *which
> is not evaluated*, or a parenthesized type-id.
> -------
>
> sizeof operator does not evaluate the expression.
>
.
- Follow-Ups:
- Re: The act of sizeof(++i) ?
- From: Alex Blekhman
- Re: The act of sizeof(++i) ?
- References:
- The act of sizeof(++i) ?
- From: Frederick Ding
- Re: The act of sizeof(++i) ?
- From: Alex Blekhman
- The act of sizeof(++i) ?
- Prev by Date: Re: memcpy performance issues
- Next by Date: Re: The act of sizeof(++i) ?
- Previous by thread: Re: The act of sizeof(++i) ?
- Next by thread: Re: The act of sizeof(++i) ?
- Index(es):
Relevant Pages
|