null args to macros in ANSI C

Mark Davies mark at comp.vuw.ac.nz
Tue Oct 10 05:53:33 AEST 1989


Is objecting to the following bit of code an ANSI'ism?

#define mem_alloc(s) malloc(s)

extern char *mem_alloc();

gcc 1.36 complains (well actually its preprocessor does) about no args to
macro `mem_alloc' and code seems to have been added to explicitly catch
this case (when not invoked with -traditional).

Why doesn't ANSI C allow the arguments of macros to be null strings?
Admittedly if the above was "real" ANSI code it would be prototyped and so
would work.

mark
--
 mark at comp.vuw.ac.nz    |
 ...!uunet!vuwcomp!mark |				DEV_BSIZE forever!



More information about the Comp.lang.c mailing list