This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mips-sgi-irix5.3


	My package uses -D__USE_FIXED_PROTOTYPES__ by default (*), because it
	prefers to compile under as up to date header files as possible.
	Specifically, if the gcc folks know about obvious flaws in header
	files, I'd rather deal with the fixed versions since the turnaround
	time is much faster.

-D__USE_FIXED_PROTOTYPES__ can be a dangerous option.  What this does is
add and/or modify prototypes to conform to recent standards.  But while gcc can
fix the header files, it can not fix the libraries that you link with.  If gcc
does something like add a missing const there is no problem.  But sometimes
gcc makes incompatible type substitutions.  This can result in cases where
a buggy program will give a compiler warning/error if you use `gcc', but
will compile without warnings/errors and then fail at runtime if you
use `gcc -D__USE_FIXED_PROTOTYPES__'.  This is especially a problem for
old systems, and systems where int and long are not the same size.

The classic example is *sprintf on old BSD derived systems, like SunOS4.
In the SunOS4 C library, they return a char *.  In POSIX, they return an int.

Another example is getgroups, which takes a gid_t * (aka unsigned short *)
in POSIX, but which takes an int * in old BSD systems.  This problem arises
if you use gcc's unistd.h file, though.  It isn't a __USED_FIXED_PROTOTYPES__
problem.

Jim


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]