Barry Smith <bsm...@mcs.anl.gov> writes:

>> Well, the size of enums in general is compiler-dependent.
>
>   Sure, but with THIS compiler it is 4 hence will not be promoted. So the 
> compiler is being obnoxious complaining about code that might have 
> difficulties with other compilers IMHO.

We usually appreciate it when compilers call out non-portable code.

>>  (I think our
>> use of PetscEnum is technically incorrect unless we have already ensured
>> that the actual enums have that size.)  But even if the size varies by
>> enum, it's still well-defined and behaves like the compatible int as far
>> as varargs should be concerned.
>
>   Interestingly I found somewhere on the web that anything smaller than int 
> is always promoted to int size when passed through ... in the same way float 
> is promoted to double.  So if the enum had size 2 it would be promoted to 
> size 4 when passed through ... and thus the warning from the compiler would 
> be reasonable, IMHO.  Just a random page that discusses the promotion 
> https://www.eskimo.com/~scs/cclass/int/sx11c.html

Yeah, good point.  We could force the enum to be 4 bytes, but I doubt
that would fix the warning.

Attachment: signature.asc
Description: PGP signature

Reply via email to