[fpc-pascal] C Enum vs. Integer
Johann Glaser
Johann.Glaser at gmx.at
Wed Sep 12 19:11:04 CEST 2012
Hi!
I'm working on a header translation for LibUSB and its fork libusbx.
They define several data types as C enums (for examples, see
http://libusbx.sourceforge.net/api-1.0/group__desc.html ).
They excessively use direct assignment of enum values, and even use one
value multiple times (e.g. LIBUSB_CLASS_PTP = 6, LIBUSB_CLASS_IMAGE =
6).
Can I translate this 1:1, i.e., define an Enum in Pascal and just ignore
the compiler warnings about reused values?
Or should I rather define all these types as Integer and define
constants for all values?
One more question: In some C structs and function parameters and return
values these enums are used too. How can I assure that the same memory
allocation is used?
Thanks
Hansi
More information about the fpc-pascal
mailing list