Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2007-10-31 13:50:28


Emil Dotchevski wrote:
> I am wondering why does error_code.hpp include <winerror.h>?
>
> All it does is translate the error codes defined in <winerror.h> to a
> enum values defined in error_code.hpp; however this enum is
> windows-specific anyway and the user can't use it without
> <winerror.h>. So, why not leave it up to the user to include
> <winerror.h> if they care about those values to begin with?

Actually, the user *can* use the enum without <winerror.h>.

> My problem is that I get a compile error under Windows, because I
> (indirectly) include error_code.hpp in my own cpp that is supposed to
> be platform-independent, and as such it does not see the platform SDK.

Hum... Although the library itself needs to see the platform SDK, user
code shouldn't be forced to use it.

The usual case, however, is that the user does want the platform's enum
available. So the Windows default needs to #include <winerror.h>. The
question then becomes how to suppress that if not wanted.

How about a BOOST_SYSTEM_NO_ENUM macro, which suppresses the system
specific enum?

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk