Re: Use enum to declare errno values
From: Bill Davidsen
Date: Tue Nov 29 2005 - 09:45:09 EST
Giuliano Pochini wrote:
On 23-Nov-2005 Denis Vlasenko wrote:
On Wednesday 23 November 2005 15:24, moreau francis wrote:
Hi,
I'm just wondering why not declaring errno values using enumaration ? It is
just more convenient when debuging the kernel.
Enums are really nice substitute for integer constants instead of #defines.
Enums obey scope rules, #defines do not.
However enums are not widely used because of
1. tradition and style
2. awkward syntax required: enum { ABC = 123 };
The value of an enum constant must be representable as an int. This
is not always the case, expecially with hardware constants and bit
masks, which may require an unsigned int.
Could you provide an example of where the ERRNO is not an integer? It
doesn't take on bit values, nor can I spot a plcae where the value is so
large it would overflow if signed.
See errno.h for a starting point. I do think error_t is a good idea,
although I doubt there's an example of a type mismatch going uncaught
without it.
--
-bill davidsen (davidsen@xxxxxxx)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/