Re: The act of sizeof(++i) ?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
>


.



Relevant Pages

  • Re: tryick use of sizeof again[Explaination Wanted]
    ... producing code for evaluating that expression. ... Kindly quote chapter and verse from _any_ version of the C standard ... The sizeof operator yields the size of its operand, ...
    (comp.lang.c)
  • Re: OT: Requesting C advice
    ... The sizeof operator yields the size of its ... operand, which may be an expression or the parenthesized ... result is an integer constant. ... The word "byte" appears dozens of times in the Standard, ...
    (Fedora)
  • Re: The act of sizeof(++i) ?
    ... Frederick Ding wrote: ... The sizeof operator yields the number of bytes in the object ... representation of its operand. ... Prev by Date: ...
    (microsoft.public.vc.language)
  • :Re: Sizeof and increment operators
    ... The ISO C standard has carefully defined sizeof so that it can be evaluated ... to a constant during parsing. ... The operand of a sizeof operator is usually not evaluated ...
    (comp.lang.c)
  • Integers (was: Decimal Arithmetic
    ... mathmatics) BUT that within programming languages, it may become ... definition of integers within the ISO 2002 COBOL Standard (with NO claim that ... When the term 'integer' is used as a constraint for an operand in a syntax ... My assumption is that the ISO Standards for Fortran and ...
    (comp.lang.pl1)