[fpc-pascal] PACKENUM and MINENUMSIZE

Lukas Gradl fpc at ssn.at
Thu Sep 11 12:24:17 CEST 2008


Forgot to add: No difference between i386 and x64.

regards
Lukas

Lukas Gradl schrieb:
> As far as i can understand the fpc sources it's in compiler/scanner.pas, 
> line 359ff:
> 
>            { Default enum packing for delphi/tp7 }
>            if (m_tp7 in current_settings.modeswitches) or
>               (m_delphi in current_settings.modeswitches) then
>              current_settings.packenum:=1
>            else if (m_mac in current_settings.modeswitches) then
>              { compatible with Metrowerks Pascal }
>              current_settings.packenum:=2
>            else
>              current_settings.packenum:=4;
> 
> So it would be 1 fpr Delphi and TP7 mode, 2 for mac (don't know that) 
> and 4 for all others.
> 
> Did a little test program on that. With {$mode objfpc} result is 4, with 
>  {$mode delphi} result is 1. (And the most important for me: Its the 
> solution to my problem with UIB - will post the reason as an answer to 
> that posting!)
> 
> program Project1;
> 
> {$mode objfpc}
> {$H+}
> 
> Uses SysUtils;
> 
> type
>   TEnumTestType = (
>     etOne,
>     etTwo,
>     etThree,
>     etFour,
>     etFive,
>     etSix,
>     etSeven,
>     etEight,
>     etNine,
>     etTen,
>     etEleven,
>     etTwelve,
>     etThirteen,
>     etForteen
>   );
> 
> var
>   ET: TEnumTestType;
> 
> begin
>   writeln(IntToStr(SizeOf(ET)));
> end.
> 
> Regards
> Lukas
> 
> 
> Michael Van Canneyt schrieb:
>>
>> On Thu, 11 Sep 2008, Marco van de Voort wrote:
>>
>>> In our previous episode, Michael Van Canneyt said:
>>>>> As far as I could find in the docs it depends on $MODE: for $MODE 
>>>>> OBJPAS it's
>>>>> 4 but I could'nt find the default for $MODE DELPHI.
>>>> Where did you read that this depends on $MODE ?
>>>> It just says that the default (contrary to Delphi) is 4.
>>> Then the doc is wrong, since sizeof (enum with one element) is 1 in 
>>> Delphi
>>> mode.
>>
>> No problem, if someone would tell me the exact behaviour, I will 
>> change it.
>>
>> Michael.
>> _______________________________________________
>> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
> 

-- 

--------------------------
software security networks
Lukas Gradl <fpc#ssn.at>
Eduard-Bodem-Gasse 9
A - 6020 Innsbruck
Tel: +43-512-214040-0
Fax: +43-512-214040-21
--------------------------



More information about the fpc-pascal mailing list