Declaration within a loop.

Conor P. Cahill cpcahil at virtech.UUCP
Thu Sep 28 10:06:09 AEST 1989


In article <559 at crdos1.crd.ge.COM>, davidsen at crdos1.crd.ge.COM (Wm E Davidsen Jr) writes:
>   Most C compilers allocate space on the stack for this when the
> procedure is entered. It therefore is not a practical thing to do to
> save space. The most common use is to correct for having forgotten to
> declare a variable at the start of a procedure.


There are two reasons that I will normally use for justifying variable
declarations and neither of them are to save space.

The first is #define macros. For example:

	#define	DEBUG(key,msg) {char buf[512];.... }

The second is to try to segregate the use of register variables.  I'm not
too sure this really has an effect in all compilers, but at least it gives
it a chance.

-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+



More information about the Comp.lang.c mailing list