[fpc-devel] Typed addresses, revisited

Daniël Mantione daniel.mantione at freepascal.org
Sun Oct 8 11:31:13 CEST 2006



Op Sun, 8 Oct 2006, schreef Jonas Maebe:

> 
> On 07 Oct 2006, at 21:42, Micha Nelissen wrote:
> 
> > I propose to enable it for 2.3/2.9, i.e. after 2.2, because, as Jonas
> > said, it breaks semantics for arithmetic on non-typecasted pointers that
> > point to something that is not size 1.
> 
> How will this change after 2.2?
> 
> > To that end, the compiler will now warn you of possible {$T+}-breaking
> > code: when you do arithmetic on an untyped pointer. Tests tbf/tb0182,
> > tbf/tb0183, and tbs/tb0504 test the proper working of this warning.
> 
> I don't like this. There is nothing wrong with pointer arithmetic on untyped
> pointers.

Just my opinion, but I think there is. You don't know the size of the 
object it is pointing to, so you should not be able to do arithmetic on it.

Daniël


More information about the fpc-devel mailing list