Enum type safety in NPNGetValue

Karl Tomlinson karlt at karlt.net
Thu Jun 3 16:14:37 PDT 2010


> enum Foo {
>  Bar = 1,
>  FooBar = 2,
>
>  Foo_ForceInt32 = 0xffffffff
> };

That will make the underlying C++ type unsigned int on systems
with 32-bit ints.
(Signed int may still be used on systems with 64-bit ints).

But in C, are all enums of type (signed) int?

Not sure that matters too much, given that the sizes will be the same.

I like the suggestion of using explicitly sized (signed or
unsigned) integers.  It avoids C/C++ differences.

Though, I would be interested to hear if there is a C++ compiler
that breaks C compatibility by using enum types smaller than int.


More information about the plugin-futures mailing list