[fpc-devel] Bug #0021641: Array of const gives check range error

patspiper patspiper at gmail.com
Wed Apr 4 10:16:14 CEST 2012

On 04/04/12 01:57, Jonas Maebe wrote:
> On 03 Apr 2012, at 20:27, patspiper wrote:
>> The following is related to bug #0021641 (Array of const gives check range error).
>> Is it correct for the exception to manifest itself in the dword case and not the qword one?
>>   writeln(Format('%d', [qword(qword(High(Int64))+1)]));  //ok
>>   writeln(Format('%d', [dword(dword(High(integer))+1)]));  //exception
> Yes, it's correct, because as mentioned in the bug report tvarrec can hold a qword, but not a dword (and dword must be passed as 32 bit = longint for Delphi compatibility).
Following the same logic, a qword must be passed as 64 bit = Int64 for 
Delphi compatibility, as Delphi's TVarRec can hold integer and Int64, 
but not qword nor dword.

In contrast, FPC's TVarRec can hold integer, Int64, and qword, meaning 
that a qword is passed as a qword and not Int64. So since FPC's TVarRec 
includes qword while Delphi's does not, why not add dword as well?


More information about the fpc-devel mailing list