the ++ operator

John Tsiombikas (Nuclear / the Lab) nuclear at siggraph.org
Fri Nov 21 23:26:58 EET 2003


Steve Stavropoulos wrote:
>>	c = a[i] + b[i++];
>>
>>τότε ο compiler δεν υποχρεούται να υπολογίσει τα a[i] και b[i++] με
>>κάποια συγκεκριμένη σειρά, 
> 
>  La8os! O compiler symfwna me thn ansi c exei _plhrws_ defined symperifora 
> otan blepei to ++ ws prefix h postfix. Otan einai prefix tote to 
> increment 8a ginei PRIN to evaluation ths ypoloiphs protashs, enw otan 
> einai postfix tote to increment 8a ginei META to evaluation ths ypoloiphs 
> protashs.
>  Sto "The C programming language (ansi C)" second edition, page 46, twn 
> Kernighan kai Richie anaferete:
>  "But the expression ++n increments n _before_ its value is used, while 
> n++ increments n _after_ its value has been used. This means that in a 
> context where the value is being used, not just the effect, ++n and n++ 
> are different. If n is 5, then
> 	x = n++;
> sets x to 5, but
> 	x = ++n;
> sets x to 6. In both cases, n becomes 6."
> 
> 

Filtate steve, prin anafoneis "LATHOS" kai diarignieis ta imatia sou, sto melon 
se parakalo diabaze ligo gia ti prama milame prota.
Kaneis den eipe oti to i++ den einai defined, alla oti to i + i++ den einai 
defined, allo to ena allo to allo.

-- Nuclear / the Lab --




More information about the Linux-greek-users mailing list