Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-09

sizeof(Enumerated type in Delphi 5) sizeof(The same type in FPC)

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis Poon
In Delphi 5,
  var
   G  : TAutoRefreshFlag;
//where type TAutoRefreshFlag = (arNone, arAutoInc, arDefault);

sizeof(G) returns 1

in FPC
if defined

   type TAutoRefreshFlag = (arNone, arAutoInc, arDefault);
and same
   Var G : TAutoRefreshFlag;

sizeof(G) returns 4.

This different behaviour break some code when I port them from Delphi 5 to FPC.

Is there a compiler directive I can do to ensure compatibility?

Dennis

Reply by email

Jonas Maebe
to Dennis Poon
Dennis Poon wrote 7 lines
In Delphi 5, var G : TAutoRefreshFlag; //where type TAutoRefreshFlag = (arNone, arAutoInc, arDefault); sizeof(G) returns 1

[snip]

This different behaviour break some code when I port them from Delphi 5 to FPC. Is there a compiler directive I can do to ensure compatibility?
{$mode delphi}
Or, if you want to have that behaviour in an FPC mode, {$z1} or
{$packenum 1}

Jonas

Reply by email