Header files with enums instead of defines?

Greg 'groggy' Lehey grog at FreeBSD.org
Wed Dec 22 15:11:21 PST 2004


On Wednesday, 22 December 2004 at 11:48:35 -0700, M. Warner Losh wrote:
> In message: <41C9C015.7050706 at freebsd.org>
>             Scott Long <scottl at freebsd.org> writes:
>> M. Warner Losh wrote:
>>> In order to gain the benefits of the enums, errno would need to be an
>>> enum errno_t or some such.  This breaks C++ code that sets errno = 0,
>>> since you can't assign integers to errno values.
>>>
>>> So even if you retained EBOGUS or whatever, this wouldn't work with
>>> C++.  errno has to be an int to work there.
>>
>> I think you might have missed that nothing was actually being declared
>> with the errno_t type, but rather the type was used as a cast for gdb.
>> It's a neat trick, but still a little cumbersome unless gdb was taught
>> about it or given some clever macros.
>
> Then why bother...  Is typing something complex to gdb really better
> than "grep $number /usr/include/sys/errno.h"?

No, but getting it automatically is.

Greg
--
See complete headers for address and phone numbers.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20041223/7519eb4b/attachment.bin


More information about the freebsd-arch mailing list