Re: Whacky increment/assignment logic with $foo++ vs ++$foo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>        int a = 2;
>        b = a++;
>        printf("b = [%d]\n", b);
>
> "b" would be 2 when printed.  However, after the second line (b = a++;)
> finished executing, "a" would then be 3.

Sure, but that code is perfectly clear. It's the odd special case
where you assign the variable to itself, that's ambiguous. Like Daevid
said, academic at this point -- but it might shed light on some
compiler-design decisions that I don't have the vocabulary for.

OTOH it could just a be a unique case with unpredictable results.

Ben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux