comp.lang.c
[Top] [All Lists]

Re: Enum type check in function call

Subject: Re: Enum type check in function call
From: Chris Dollin
Date: Fri, 28 Mar 2008 13:51:51 +0000
Newsgroups: comp.lang.c

Richard wrote:

> Ian Collins <ian-news@xxxxxxxxxxx> writes:
> 
>> Pritam wrote:
>>> Facing a little issue with gcc ( maybe all c compiler have behaves
>>> this way for the problem)
>>> 
>>> Got a function that takes in a enumerated type. Even if another
>>> enumerated type is passed 'gcc' does not raise any warnings or error.
>>> 'g++' generates a error msg for the same. Is there a way to turn on
>>> enum type checks while passing to functions in 'gcc'.
>>> 
>> That's a "feature" of C, corrected in C++!
>>
>> Enums aren't really types in C.
> 
> Are they not just ints?

The /constants/ are just ints, but the `enum wossname`s aren't; they're
(impoverished) types. I took Ian to mean the sort-of-type Enum, not the
named-elements-of.

-- 
"What would that matter, if it made a good book?"                 /Gaudy Night/

Hewlett-Packard Limited registered office:                Cain Road, Bracknell,
registered no: 690597 England                                    Berks RG12 1HN


<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy