cxx icon indicating copy to clipboard operation
cxx copied to clipboard

Documentation needs to mention that enums in "extern C++" need to be `uint8_t`

Open johnperry-math opened this issue 2 years ago • 1 comments

Today I kept hitting the error where my enum's were the wrong size. This was fixed by changing the C++ side from

enum class Something { First, Second };

to

enum class Something : uint8_t { First, Second };

As far as I can tell, the documentation does not mention this. Perhaps it should?

johnperry-math avatar Mar 29 '22 20:03 johnperry-math

Another option is #[repr(u32)] at the Rust side.

hombit avatar Jan 25 '23 16:01 hombit