OT programovanie v C: perla z nasho Labuanu

Josef Stengl ok1ced na nagano.cz
Úterý Květen 11 09:17:03 CEST 2010


dle ISO/IEC 9899:1999(E) je to podle me v C99 mozne.

6.8.5.3 The for statement

1 The statement
for ( clause-1 ; expression-2 ; expression-3 ) statement
behaves as follows: The expression expression-2 is the controlling expression that is
evaluated before each execution of the loop body. The expression expression-3 is
evaluated as a void expression after each execution of the loop body. If clause-1 is a
declaration, the scope of any variables it declares is the remainder of the declaration and
the entire loop, including the other two expressions; it is reached in the order of execution
before the first evaluation of the controlling expression. If clause-1 is an expression, it is
evaluated as a void expression before the first evaluation of the controlling expression.133)

2 Both clause-1 and expression-3 can be omitted. An omitted expression-2 is replaced by a
nonzero constant.

133) Thus, clause-1 specifies initialization for the loop, possibly declaring one or more variables for use in
the loop; the controlling expression, expression-2, specifies an evaluation made before each iteration,
such that execution of the loop continues until the expression compares equal to 0; and expression-3
specifies an operation (such as incrementing) that is performed after each iteration.

ced

Jan Waclawek wrote:
> No uz som si to pozrel: n1256.pdf to v 6.8.5.3 dovoluje, ale just vedla toho je taka ta zvislica na okraji co oznacuje novinky. Skutocny C99 co sa kupuje za tezky prachy nemam, takze som z toho nie mudrejsi... :-(
> 
> wek
> 
> 
>>> V cistom C nepovoli ani to for(int i...
>> GCC to dovoli, ak je nastaveny niektory C99-kompatiibilny mod, ale asi to v C99 ako takom nie je (momentalne nie som pri kompe aby som si to overil).
> _______________________________________________
> HW-list mailing list  -  sponsored by www.HW.cz
> Hw-list na list.hw.cz
> http://list.hw.cz/mailman/listinfo/hw-list


More information about the Hw-list mailing list