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

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

 



Ben Dunlap wrote:
... and, in fact, that /is/ how C behaves. The following code:

No, that's implementation's behaviour. AFAIK, the normative document give to compiler the behaviour implementation. So, it can do optimization, that gives strange behaviour for a people how think increment operators had a wall defined behaviour.

	int a = 2;
	a = a++;
	printf("a = [%d]\n", a);

Will output "a = [3]". At least on Ubuntu 9 using gcc 4.3.3.

  That's gcc way :)

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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