10Fermer12
SallyLe 05/11/2007 à 14:05
A cast is a valid lvalue if its operand is an lvalue. A simple assignment whose left-hand side is a cast works by converting the right-hand side first to the specified type, then to the type of the inner left-hand side expression. After this is stored, the value is converted back to the specified type to become the value of the assignment. Thus, if a has type char*, the following two expressions are equivalent:

(int)a = 5
(int)(a = (char *)(int)5)

An assignment-with-arithmetic operation such as += applied to a cast performs the arithmetic using the type resulting from the cast, and then continues as in the previous case. Therefore, these two expressions are equivalent:

(int)a += 5
(int)(a = (char *)(int) ((int)a + 5))
http://tigcc.ticalc.org/doc/gnuexts.html#SEC70

Autrement dit (blabla) truc = machin c'est la même chose que truc = (blabla) machin, à la seule différence près que la valeur globale de l'expression (qui de toute façon ne sert presque jamais à rien tongue) aura le type blabla dans le premier cas alors qu'elle aura le type de truc dans le second. À moins que j'aie mal compris.