Comme quoi on en apprend tous les jours :
" An often-cited example is the C expression i=i++, which apparently both assigns i its previous value and increments i. The final value of i is ambiguous, because, depending on the order of expression evaluation, the increment may occur before, after, or interleaved with the assignment. The definition of a particular language might specify one of the possible behaviors or simply say the behavior is undefined. In C and C++, evaluating such an expression yields undefined behavior.[2]"
Moi qui était persuadé que l'ordre était défini dans la spec et donc que tous les compilateurs faisaient pareil... Bon, ben je saurai maintenant, lecture intéressante.
[^] # Re: En vrac
Posté par Zenitram (site web personnel) . En réponse à la dépêche Naissance d'un géant : Java. Évalué à 6.
Comme quoi on en apprend tous les jours :
" An often-cited example is the C expression i=i++, which apparently both assigns i its previous value and increments i. The final value of i is ambiguous, because, depending on the order of expression evaluation, the increment may occur before, after, or interleaved with the assignment. The definition of a particular language might specify one of the possible behaviors or simply say the behavior is undefined. In C and C++, evaluating such an expression yields undefined behavior.[2]"
Moi qui était persuadé que l'ordre était défini dans la spec et donc que tous les compilateurs faisaient pareil... Bon, ben je saurai maintenant, lecture intéressante.