[fpc-devel] Typed addresses by default

Ivo Steinmann ivo_steinmann at gmx.net
Thu Oct 5 14:45:15 CEST 2006


Micha Nelissen schrieb:
>> Hi,
>>
>> Attached patch modifies compiler to enable typed addresses ({$T+}) for
>> fpc and objfpc modes by default. It fixes the rtl and compiler to
>> compile again. Most of these fixes are simple pointer to array vs.
>> pointer to element of array changes, but some reveal ugly code IMHO ;-).
>>
>> Anyway, any opinions on whether it is useful to enforce typed addresses
>> by default ?

Well, it's a good idea to enable typed addresses by default, but I have 
got one problem with that. The pointer to an array of a type should be 
allowed to assign to the pointer of the same type.

Example

T: array[-10..10] of Integer;
P: PInteger;

// is not allowed now
P := @T;

// is not a replace for
P := @T[0];

// is a dirty replace
P := Pointer(@T);

// is the right replace
P := @T[Low(T)];


I request that "P := @T;" should be allowed, because a pointer type in 
objfpc mode are also treated as pointer to an array of that type, that 
means  P[...] is allways allowed also.


greets
Ivo Steinmann (Aison)



More information about the fpc-devel mailing list