egcs, does gcc fixincludes etc guarantee a stdlib.h exists?
Jim Wilson
wilson@cygnus.com
Mon Apr 20 22:16:00 GMT 1998
Alternatively, we could put malloc, realloc, calloc and free outside of
__USE_FIXED_PROTOTYPES__ in the generated stdlib.h.
I have been trying to discourage you from fixing this problem in stdlib.h
because I believe it is unsafe to put stuff there by default.
I just remembered another problem. There exist many programs which have
their own declarations of these C library functions. Some of them them
have wrong definitions. Some of them have definitions which are not valid
POSIX, but which agree with the system's man pages. There may also be
declarations in the system header files in other files which are not POSIX.
If we add our own POSIX declarations to stdlib.h, we run the risk that some
programs won't compile with gcc anymore. Dealing with all of these bug reports
will be a hassle, and I would rather not have them in the first place.
free incidentally is not entirely safe, because many older systems define
it as returning int, whereas ISO C says it returns void.
I can see that the Objective C runtime library is a problem. However, it
looks like they already have a fix for it there. objc/misc.c defines
__USE_FIXED_PROTOTYPES__ itself. That at least limits the damage to the
Objective C runtime library. If the target system has POSIX incompatibilities,
then the Objective C runtime may fail to work, but at least C programs will
still work.
Jim
More information about the Gcc
mailing list