Welcome to the Kunena forum!

Tell us and our members who you are, what you like and why you became a member of this site.
We welcome all new members and hope to see you around a lot!
  • Page:
  • 1

TOPIC: Enumeration size between BCB5 and RAD Studio 10.2 (C++)

Enumeration size between BCB5 and RAD Studio 10.2 (C++) 1 week 1 day ago #14367

Hi,

I'm migrating a BCB5 app to RAD and I need to find a good way to be able to open, into the new RAD version, my old custom files created by the BCB5 app using TFileStream.
Actually it seems that the strored values of enumerated type values are not compatible between both app when using the sizeof to write or read my enum values from the stream. I read that RAD change the size accordinglys to the enumerators qt.

Is there a way to get compatibility between BCB5 and RAD Studio 10.2 C++?


Thank you,
RW

Please Log in or Create an account to join the conversation.

Enumeration size between BCB5 and RAD Studio 10.2 (C++) 1 week 1 day ago #14373

Go into the Project Options and make sure that both compilers are configured to use the same setting for enum sizes. An enum can either be a fixed-sized integer, or it can be variable-sized (1, 2, or 4 bytes) depending on the smallest size needed to hold all of the enum's values.

Alternatively, modern versions of C++Builder support strongly typed enums , which (amongst other things) allows you to specify the underlying data type used by an enum, so you can control its exact size in code.

Please Log in or Create an account to join the conversation.

Last Edit: by Remy.

Enumeration size between BCB5 and RAD Studio 10.2 (C++) 1 week 1 day ago #14380

Ok thank you Remy,

I did a little test a little earlier unsuccessfully since my older app stop to work properly, but I will try again.

Cheers,
RW

Please Log in or Create an account to join the conversation.

Enumeration size between BCB5 and RAD Studio 10.2 (C++) 1 week 16 hours ago #14394

Ok excellent,
I set to false the compiler Ā«full size enumerationsĀ» option and all is fine.

RW

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Moderators: April Anne