Mail Archives: djgpp/1998/06/15/02:33:30
On 14 Jun 1998, Gili wrote:
> "enum listing
> {
> a=0x00,
> b=0x02
> };
>
> function(listing input)
> {
> }
> "
>
> Now, in my main() code I use "function(a|b)" and DJGPP reports that
> my argument should be an "int" not a type "listing".
Please post code that you actually used. The above snippet doesn't
compile ("parse error"), and while I can fix it, I'm unsure what did
your original code actually say, including the main function which you
didn't post at all.
You cannot hope for an accurate answer without posting the actual
source.
> There is no need to expand the size to an "int" because
> any element of type "listing" when || (ORed) with another element will
> always remain within the confines of the listing-type.
This is certainly incorrect in general. Your enumeration defines only
two possible values: 0 and 2. Should it define 1 and 2, ORing them
would produce 3 which is invalid for this enumeration.
Also, I strongly suspect that the type of an expression "a|b" is an
int, regardless of its value. (Could any ANSI guru please confirm
this?)
But please post the correct source, so that this problem could be
analyzed properly.
- Raw text -