[fpc-pascal] Illogical automatic dereferencing

Henry Vermaak henry.vermaak at gmail.com
Sun Oct 11 14:31:19 CEST 2009


2009/10/11 Graeme Geldenhuys <graemeg.lists at gmail.com>:
> On 11/10/2009, Henry Vermaak <henry.vermaak at gmail.com> wrote:
>>  >
>>  > Sizeof(X) is 10 bytes.
>>  > Sizeof(PX) is 4 bytes.
>>  >
>>  > Still you can use X[1] and PX[1]. That's illogical.
>>
>>
>> I've tested this now and could only get this behaviour with {$mode delphi}.
>
> So what did the other modes return?  objfpc?

It produced a compilation error:

array_test.pas(17,27) Error: Can't read or write variables of this type

You have to dereference the pointer to the array, i.e. pia^[x].

Henry



More information about the fpc-pascal mailing list