
Emil Dotchevski wrote:
Actually, the user *can* use the enum without <winerror.h>.
I see this in error_code.hpp:
namespace windows_error { enum windows_error_code { success = 0, // These names and values are based on Windows winerror.h invalid_function = ERROR_INVALID_FUNCTION, file_not_found = ERROR_FILE_NOT_FOUND, path_not_found = ERROR_PATH_NOT_FOUND, .... } }
I don't understand how this enum can be compiled without including <winerror.h>.
How about a BOOST_SYSTEM_NO_ENUM macro, which suppresses the system specific enum?
Perhaps the enum should be placed in a platform-specific header, for example "boost/system/windows/error_code.hpp"?
Also, how do you feel about replacing the OS-specific enums with plain ints? This way, I can compare error codes directly to the values from <winerror.h> (I understand that enums give us type safety, but unfortunately they can not be incomplete types, which leads to physical coupling and causes the kind of problems I'm hitting with error_code.hpp.)
This reminds me of http://www.ddj.com/cpp/184403894