Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uakari.primate.wisc.edu!uflorida!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: null args to macros in ANSI C Message-ID: <11247@smoke.BRL.MIL> Date: 7 Oct 89 02:12:03 GMT References: <1989Oct9.195333.2544@comp.vuw.ac.nz> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 21 In article <1989Oct9.195333.2544@comp.vuw.ac.nz> mark@comp.vuw.ac.nz (Mark Davies) writes: >Is objecting to the following bit of code an ANSI'ism? >#define mem_alloc(s) malloc(s) >extern char *mem_alloc(); No, it's simply incorrect use of C, and pre-ANSI implementations should also complain about it. Note also that malloc() should NOT be declared by the application under a standard-conforming implementation; instead #include . The function returns void* in conforming implementations. I don't know why you want to rename malloc, but #define mem_alloc malloc will do it correctly. >Why doesn't ANSI C allow the arguments of macros to be null strings? There are numerous reasons. Making this work in full generality involves some tricky engineering, and not enough of the committee were convinced that it was worth the effort.