Title: RE: RE: Post incr�mentation surprenante

Selon les specs :

15.6.1 Evaluate Left-Hand Operand First
The left-hand operand of a binary operator appears to be
fully evaluated before any part of the right-hand operand
is evaluated. For example, if the left-hand operand contains
an assignment to a variable and the right-hand operand contains
a reference to that same variable, then the value produced by
the reference will reflect the fact that the assignment occurred
first.

Dans ton cas, on peut traduire par :

taille = ( taille = ( taille + 1 ) )

La partie de gauche �tant toujours �valu�e en premier,
l'affectation se fait avant �valuation de + 1.

J'ai bon ?

Olivier


> -----Message d'origine-----
> De : Yann Secq [mailto:[EMAIL PROTECTED]]
> Envoy� : mardi 26 f�vrier 2002 14:19
> � : joss
> Cc : [EMAIL PROTECTED]
> Objet : Re: RE: Post incr�mentation surprenante
>
>
> joss wrote:
> > en java, la syntaxe correcte est :
> > taille++; pour incr�menter la valeur de taille, c'est tout.
> tu n'as pas �
> > faire taille = taille++;
>
> Bonjou, effectivement mais le but ici est pour moi de comprendre
> pourquoi le comportement est diff�rent du programme en C.
>
> Je suppose que c'est la s�mantique de l'op�rateur d'affectation
> qui en est la cause, mais j'aimerai en etre sur.
>
> Merci, yann.
>
> --
>   / Yann SECQ            Equipe SMAC           [EMAIL PROTECTED] \
> | Multi-Agent Systems Modeling & Agent Oriented Programming |
>   \ http://www.lifl.fr/SMAC        http://www.lifl.fr/~secq /
>

Répondre à