This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: getopt with gcc -ansi


On Wed, 11 Aug 2004, Paul Eggert wrote:

> But in POSIX 1003.1-2004, getopt and sleep are both required functions
> on the same footing; neither is an XSI extension, for example.
> Perhaps this wasn't true in older POSIX revisions, but it's true now.
> The "-ansi" flag should affect only the C standard level, not the
> POSIX revision level, no?

-ansi sets the baseline as C89 function only, feature test macros must be 
defined for the rest.  The non-C89 headers may be simplified by declaring 
some other functions anyway if all relevant standards say they must, but 
-ansi plus non-C89 functions is only meant to be used with feature test 
macros.  There is a brief note in CONFORMANCE about use of -ansi plus 
feature test macros, though it is silent on the undefined case of using 
POSIX headers without the necessary macros.

Using -ansi -D_POSIX_C_SOURCE=200112L will get you the getopt declaration.

-- 
Joseph S. Myers
jsm@polyomino.org.uk


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