gcc and NULL function pointers.
Tim McDaniel
mcdaniel at adi.com
Fri Jun 28 01:26:34 AEST 1991
In article <1991Jun27.011959.14714 at ringer.cs.utsa.edu>
djimenez at ringer.cs.utsa.edu (Daniel Jimenez) writes:
It won't do just to have a Pascal 'nil' in all pointer contexts,
because pointers can be of different sizes.
But if "nil" occurred in a context where the compiler couldn't
determine the proper pointer type, an error message would be output.
That would, I think, solve all the problems; both
int i = nil;
execl("this", "that", "the other", "and", "more", nil);
would produce error messages, as I would expect. In the absence of a
time machine, I think we could do
#define NULL __nil
today, and "__nil" could have the semantics above. I don't think this
could break any strictly-conforming ANSI C programs. "__nil" could
instead mean "0" or "(void *) 0" with special switches, say "-ansi
-pedantic". Anyone want to suggest it to the gcc maintainers?
--
"Of course he has a knife; he always has a knife. We all have knives.
It's 1183 and we're barbarians." -- Eleanor of Aquitaine, "A Lion in Winter"
Tim McDaniel Applied Dynamics Int'l.; Ann Arbor, Michigan, USA
Internet: mcdaniel at adi.com UUCP: {uunet,sharkey}!amara!mcdaniel
More information about the Comp.std.c
mailing list