[fpc-devel] Just need to double check the size of Integer

J. Gareth Moreton gareth at moreton-family.com
Thu Nov 24 14:50:01 CET 2022


Would it be better to define "SizeInt = SmallInt;" here just so it's 
crystal clear what size it is?

Kit

On 24/11/2022 13:41, Michael Van Canneyt via fpc-devel wrote:
>
>
> On Thu, 24 Nov 2022, Marco van de Voort via fpc-devel wrote:
>
>>
>> On 24-11-2022 14:25, Ondrej Pokorny via fpc-devel wrote:
>>> Am 24.11.2022 um 14:15 schrieb Marco van de Voort via fpc-devel:
>>>> On 24-11-2022 14:13, J. Gareth Moreton via fpc-devel wrote:
>>>>>
>>>>> I just need to double-check something.  Under CPU16, SizeInt and 
>>>>> SizeUInt are declared as follows:
>>>>>
>>>>>   SizeInt = Integer;
>>>>>   SizeUInt = Word;
>>>>>
>>>>> Is Integer 16-bit in this case? 
>>>>
>>>> Yes.
>>>
>>> Are you sure? systemh.inc is compiled with {$mode objfpc} (see line 
>>> 22), so Integer within the system unit is 32-bit.
>>
>> 1. Then why does the posted code print 2?
>>
>> 2. using {$mode objfpc in the system unit can't load objpas that 
>> overrides the integer, even if the mode is set.
>
> Indeed, it seems to me that this directive should be removed from the 
> system
> unit.
>
> OTOH, it's probably needed to enable classes for the TObject definition ?
>
> Maybe the compiler contains some code to detect this special case.
>
> Michael.
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


More information about the fpc-devel mailing list