Balancer> HardSoft, 05.07.2004 14:14:05 :
да хз.....
ту еще предложили:
Какой бред! Пусть выкинут компилер на помойку. Даже старый-старый GCC, не говоря уже об MSVC++, даёт:
<br>main:<br> pushl %ebp<br> movl %esp, %ebp<br> subl $8, %esp<br> andl $-16, %esp<br> subl $8, %esp<br> pushl $12<br> pushl $.LC0<br> call printf<br> addl $16, %esp<br> movl %ebp, %esp<br> popl %ebp<br> ret<br>
что??????????? 12????????
Мде. И в GCC3 также. Ну, бред!
Всё, признаЮ свою ошибку и расписываюсь в самоуверенности. Нынешние компиляторы выродились (Жаль, MSVC под рукой нет, дома проверю, как там дела обстоят)[»]
Похоже, что тут в стандарте С учтено:
[quote]
©ISO/IEC ISO/IEC 9899:1999 (E)
6.5 Expressions
1. Anexpression is a sequence of operators and operands that specifies computation of a value, or that designates an object or a function, or that generates side effects, or that performs a combination thereof.
2. Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.70)
3.The grouping of operators and operands is indicated by the syntax.71) Except as specified later (for the function-call (), &&, ||, ?:, and comma operators), the order of evaluation of subexpressions and the order in which side effects take place are both unspecified.
4.Some operators (the unary operator ~, and the binary operators <<, >>, &, ^, and |, collectively described as bitwise operators) are required to have operands that have integer type. These operators return values that depend on the internal representations of integers, and have implementation-defined and undefined aspects for signed types.
5. If an exceptional condition occurs during the evaluation of an expression (that is, if the result is not mathematically defined or not in the range of representable values for its type), the behavior is undefined.
6. The effective type of an object for an access to its stored value is the declared type of the object, if any.72) If a value is stored into an object having no declared type through an lvalue having a type that is not a character type, then the type of the lvalue becomes the effective type of the object for that access and for subsequent accesses that do not modify
70) This paragraph renders undefined statement expressions such as
i = ++i + 1;
a[i++] = i;
while allowing
i = i + 1;
a[i] = i;
71) The syntax specifies the precedence of operators in the evaluation of an expression, which is the same as the order of the major subclauses of this subclause, highest precedence first. Thus, for example, the expressions allowed as the operands of the binary + operator (6.5.6) are those expressions defined in
6.5.1 through 6.5.6. The exceptions are cast expressions (6.5.4) as operands of unary operators (6.5.3), and an operand contained between any of the following pairs of operators: grouping parentheses () (6.5.1), subscripting brackets [] (6.5.2.1), function-call parentheses () (6.5.2.2), and the conditional operator ?: (6.5.15). Within each major subclause, the operators have the same precedence. Left- or right-associativity is indicated in each subclause by the syntax for the expressions discussed therein.
72) Allocated objects have no declared type.
§6.5 Language 67
[/quote]
Хотя, тут надо еще посмотреть - как именно сайд-эффекты могут откладываться.