This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

Re: sys_errlist


> From: "J. J. Farrell" <jjf@bcs.org.uk>
> 
> Since the non-underscore versions are required to be present in
> the interface definition which many modern UNIXes are based on,
> I'd say that cygwin should expose them, but no-cygwin shouldn't.
> Is it possible to expose them in a way which makes user declaration
> work, as mandated by the SVID, rather than requiring the <errno.h>
> inclusion? Both should expose the underscore versions since there's
> no harm doing so.

To add another confusing data point, I've just noticed that Microsoft
Visual C 6.0 declares _sys_errlist and _sys_nerr in <stdlib.h> rather
that <errno.h>; and if the compiler is not running in "strict ANSI"
mode and doesn't have _POSIX_ defined, it also declares sys_errlist
and sys_nerr in <stdlib.h>.

I don't know if the optimum solution can be achieved, but it would
look like:

- when in maximum UNIX compatibility mode, just declaring

    extern char *sys_errlist[]; extern int sys_nerr;

  in the code should work. Failing this, removing these declarations
  and including <errno.h> seems a reasonable option since such code
  will almost certainly be including <errno.h> already. The versions
  with leading underscores should probably be made available in the
  same way.

- when in  maximum VC++ compatibility mode, the leading underscore
  versions should be made available by including <stdlib.h>; if not
  in strict Standard C mode, the non-underscore versions should be
  available in the same way.

If it isn't possible to support declarations in the code, the simplest
solution is probably that both <errno.h> and <stdlib.h> should declare
the leading underscore names, and if not in strict Standard C mode
they should #define the no-underscore names to the underscore ones.


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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