Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2002-12-16 11:32:30


At 12:34 PM 12/13/2002, Kevin Lynch wrote:

>Iain K.Hanson wrote:
>>> We already have a standard
>>>portable
>>>error
>>> >scheme. Why reinvent the wheel? Will we do any better?
>>>
>>>We might. The POSIX errno scheme doesn't seem all that strong to me.
>>
>>
>> Agreed. I've given a fair ammount of though to this over the past year
>> ( whilst working on sockets). The conclusion I came to was that I would
>> rather have a standard C++ name on what ever platform I work on than
>> keep having to look them up on every platform.
>>
>
>I would hope that if the POSIX naming is not used, that at least the
>documentation would contain a clear mapping between the POSIX name and
>the C++ name.

Point taken. The mapping should be at least "implementation defined".

Below are the current mappings for Windows and POSIX. Anything else gets
mapped to the general "system_error" value.

Comments appreciated. Thanks,

--Beman

# ifdef BOOST_WINDOWS
         { ERROR_ACCESS_DENIED, security_error },
         { ERROR_INVALID_ACCESS, security_error },
         { ERROR_SHARING_VIOLATION, security_error },
         { ERROR_LOCK_VIOLATION, security_error },
         { ERROR_LOCKED, security_error },
         { ERROR_NOACCESS, security_error },
         { ERROR_WRITE_PROTECT, read_only_error },
         { ERROR_NOT_READY, io_error },
         { ERROR_SEEK, io_error },
         { ERROR_READ_FAULT, io_error },
         { ERROR_WRITE_FAULT, io_error },
         { ERROR_CANTOPEN, io_error },
         { ERROR_CANTREAD, io_error },
         { ERROR_CANTWRITE, io_error },
         { ERROR_DIRECTORY, path_error },
         { ERROR_INVALID_NAME, path_error },
         { ERROR_FILE_NOT_FOUND, not_found_error },
         { ERROR_PATH_NOT_FOUND, not_found_error },
         { ERROR_DEV_NOT_EXIST, not_found_error },
         { ERROR_DEVICE_IN_USE, busy_error },
         { ERROR_OPEN_FILES, busy_error },
         { ERROR_BUSY_DRIVE, busy_error },
         { ERROR_BUSY, busy_error },
         { ERROR_FILE_EXISTS, already_exists_error },
         { ERROR_ALREADY_EXISTS, already_exists_error },
         { ERROR_DIR_NOT_EMPTY, not_empty_error },
         { ERROR_HANDLE_DISK_FULL, out_of_space_error },
         { ERROR_DISK_FULL, out_of_space_error },
         { ERROR_OUTOFMEMORY, out_of_memory_error },
         { ERROR_NOT_ENOUGH_MEMORY, out_of_memory_error },
         { ERROR_TOO_MANY_OPEN_FILES, out_of_resource_error }
# else
         { EACCES, security_error },
         { EROFS, read_only_error },
         { EIO, io_error },
         { ENAMETOOLONG, path_error },
         { ENOENT, not_found_error },
         { ENOTDIR, not_directory_error },
         { EAGAIN, busy_error },
         { EBUSY, busy_error },
         { ETXTBSY, busy_error },
         { EEXIST, already_exists_error },
         { ENOTEMPTY, not_empty_error },
         { EISDIR, is_directory_error },
         { ENOSPC, out_of_space_error },
         { ENOMEM, out_of_memory_error },
         { EMFILE, out_of_resource_error }
# endif

--Beman


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