Naming

Karl Heuer karl at haddock.ima.isc.com
Tue Mar 6 09:33:34 AEST 1990


In article <5056 at scolex.sco.COM> seanf at sco.COM (Sean Fagan) writes:
>In article <16064 at haddock.ima.isc.com> karl at haddock.ima.isc.com (Karl Heuer) writes:
>>[In an example `#define malloc(n) ...']
>>The #define itself is legal (provided you first #undef any old one), but...
>
>Is it?  I was under the impression that the name 'malloc' was reserved
>completely.

I interpret this as having been legalized by the same decision that permitted
"#define char ..." (which had ambiguous legality in an earlier Draft).  The
relevant section seems to be 2.1.1.2: preprocessing is done in translation
phase 4; pp-tokens are converted into tokens and analyzed in phase 7.

As I noted before, you may be breaking other rules by doing this (see my
earlier article in this thread), but it should make it past the preprocessor.
For example, it should be legal to have this #define as the last line in a
translation unit.  (Pretty useless, too.)

Karl W. Z. Heuer (karl at ima.ima.isc.com or harvard!ima!karl), The Walking Lint



More information about the Comp.std.c mailing list