In <48EQ70$>
(³á³á³á³á) writes:
> int i = 0;
> i = sizeof( i++ );
>
> What's the result of i¡H
>
> I think the result may be sizeof( int ) or sizeof( int ) + 1, or it is
> undefined behavior.
It's sizeof(int). When the argument of sizeof is an expression (other
than a C99 VLA), it is NOT evaluated, the compiler merely determines its
type and produces the appropriate result.
> I know that i = i++ is undefined behavior,
This is a completely different issue.
> but sizeof is calculated at compiling time.
It need not be, unless used in a context where a constant expression is
required.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: