Re: enum safety
- From: Ian Collins <ian-news@xxxxxxxxxxx>
- Date: Sat, 09 Feb 2008 08:37:19 +1300
Sard wrote:
Hi,This is why (in my opinion) enums are horribly broken in C.
Page 39 K&R2 says
'Although variables of enum types may be declared, compilers need not
check that what you store in such a variable is a valid value for the
enumeration'
int main ()c is a pointer, enums are integer types.
{
enum colours purple =c ;
You would get the same diagnostic with
int n = c;
--
Ian Collins.
.
- Follow-Ups:
- Re: enum safety
- From: Army1987
- Re: enum safety
- References:
- enum safety
- From: Sard
- enum safety
- Prev by Date: Re: A solution for the allocation failures problem
- Next by Date: Re: Unsigned Long Long Overflow
- Previous by thread: Re: enum safety
- Next by thread: Re: enum safety
- Index(es):
Relevant Pages
|