[petsc-dev] Hijacked MPI calls...

Jed Brown jed at jedbrown.org
Fri Sep 16 15:15:04 CDT 2016


Barry Smith <bsmith at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160916/7f42edb1/attachment.sig>


More information about the petsc-dev mailing list