This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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] |
Ralf Corsepius wrote:On Thu, 2008-02-28 at 19:21 -0500, Gregory Pietsch wrote:To be fair, the header file itself is non-standard; it is a glibc extension and any application that includes it will need the non-standard bits (one can get getopt() already through unistd.h). The glibc version of <getopt.h> includes 3 macros: no_argument, required_argument, optional_argument that are unprotected. The sys/linux version of getopt.h defines the 3 glibc macros as well for compatibility and so should the libc/include version. I'd be happy with only having the glibc names. Joel, as one of probably few getopt.h/getopt users, do you think it would be reasonable to make this change?
I believe that I caught the problem. In your test program, the -a and -b switches weren't defined in your list of short options, so getopt was returning a question mark. Fixing the testing program and applying the latest Bug-Free(tm) getopt should work. -- Gregory
I think, some defines, you added to getopt.h with your most recent patch should be removed. In particular:
/* macros defined by this include file */ #define NO_ARG 0 #define REQUIRED_ARG 1 #define OPTIONAL_ARG 2 /* The GETOPT_DATA_INITIALIZER macro is used to initialize a statically- allocated variable of type struct getopt_data. */ #define GETOPT_DATA_INITIALIZER {0,0,0,0,0}
Rationale:
- The *_ARG macros are not name-space safe and likely to clash with other macros. If they really should be kept, then they should be prefixed with __GETOPT_.
I think that GETOPT_DATA_INITIALIZER should be underscored since it is our own invention and is current. I'll do that plus add the glibc macros.Glibc extension.- All of these macros are not standardized anywhere nor am I aware about any system providing them. I vote for removing them.
-- Jeff J.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |