bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error handling in Win32 + gnulib


From: Bruno Haible
Subject: Re: Error handling in Win32 + gnulib
Date: Sat, 28 Nov 2009 17:02:17 +0100
User-agent: KMail/1.9.9

Richard W.M. Jones wrote:
> error codes aren't compatible.
> Although Gnulib tries to define its own error numbers which are
> compatible with Win32 ones (eg. EINPROGRESS == 10036 ==
> WSAEINPROGRESS), it also uses some from the MinGW header files which
> are just plain wrong (eg. ENOMEM == 12 == ERROR_INVALID_ACCESS, MinGW
> gets this wrong, it should be ENOMEM 14 == ERROR_OUTOFMEMORY).

The error values returned by GetLastError() and those stored in errno
are in different enumerations or "namespaces". There is no relation
between them. One is a 'DWORD', the other one is an 'int'. You are
responsible, after getting a value 12 from GetLastError(), for interpreting
it as ERROR_INVALID_ACCESS, and if you get a value 12 from errno, for
interpreting it as ENOMEM.

Any system can define the possible errno values as arbitrary positive
integers, with very little constraints [1].

Bruno

[1] http://www.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]