[Bug target/40411] -std=c99 does not enable c99 mode in Solaris C library

gseanmcg at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 1 14:24:00 GMT 2012


--- Comment #27 from Sean McGovern <gseanmcg at gmail dot com> 2012-06-01 14:23:21 UTC ---
I just found out how ugly this can get.

freopen(3C) has different behaviour in the case where the first argument is
NULL depending on if SUSv3 behaviour has been enabled by including
values-xpg6.o and defining _XOPEN_SOURCE = 600.

Here's the prototype from Solaris 10 8/11:
FILE *freopen(const char *filename, const char *mode, FILE *stream);

>From the freopen(3C) manpage:
If filename is a null pointer and the application comforms to SUSv3 (see
standards(5)), the freopen() function attempts to change the mode of the stream
to that specified by mode, as though the name of the file currently associated
with the stream had been used.


If the filename is a null pointer and the application does not comform to
SUSv3, freopen() returns a null pointer.

More information about the Gcc-bugs mailing list