getopt.h vs java lossage

Ulrich Drepper
Thu Sep 10 17:58:00 GMT 1998

Jeffrey A Law <> writes:

> Ugh.  I see that GNU getopt.h actually wants to export the no_argument
> and other definitions which is a pretty clear name space violation
> (unless someone can point to ISO or ANSI specs which allow getopt.h
> to provide no_argument, required_argument and optional_argument as
> #defines (or via any other mechanism).

You are correct, these are violations.  I haven't changed it because
it breaks the interface.

> In the interest of avoiding such a visible spec change in the egcs
> getopt.h, I'll relent and fix java to avoid using those names.
> But long term someone needs to fix gnu getopt and all the code
> that depends on those bogus #defines.

The change will be to protect the definitions of struct option, the
*_argument macros, and the extra prototypes using

	#ifdef _GNU_SOURCE

If every program which relies on the extensions uses as suggested
-D_GNU_SOURCE there should not be any problem.

---------------.      drepper at  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at   `------------------------

More information about the Gcc mailing list