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)
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to