C pre-processor and ANSI standard

Tom Duff td at alice.UUCP
Thu Sep 13 01:49:23 AEST 1984


The following macro prints n spaces with none of the problems described in
previous suggestions
#define	spaces(n)	printf("%*s", (n), "")
Of course, this finesses the issues at hand (inadequate scope rules and syntactic
glitches).  It is hard for me to understand the mind of the code bummer that thinks
that saving one function call (while still calling putchar n times) is worth
breaking the language for, especially since this routine can't possibly be called
at a high enough rate (it's execution speed is surely limited by I/O bandwidth)
to justify any savings.

You CAN make a case for inline procedures.  This example is not the weapon with
which to win the battle.



More information about the Comp.lang.c mailing list