Declaration within a loop.

Alan J Rosenthal flaps at dgp.toronto.edu
Thu Sep 28 08:59:05 AEST 1989


cpcahil at virtech.UUCP (Conor P. Cahill) writes:
>This kind of thing can be verified by creating a small source code file
>and compiling it with the -S flag to get the assembly language.

This statement is blatantly false (about anything about C).  It confuses
implementation with definition.  To re-use the same variable cell each time
through the loop is a valid implementation of deallocating it and reallocating
it each time through the loop, because deallocating and allocating are inverse
operations.  This doesn't mean that the meaning of declaring a variable inside
a loop in C is that it is allocated upon function entry.

ajr



More information about the Comp.lang.c mailing list