[fpc-pascal] Pointers
Rainer Stratmann
RainerStratmann at t-online.de
Thu Feb 11 21:22:05 CET 2010
Am Thursday 11 February 2010 21:07:17 schrieb Jonas Maebe:
> On 11 Feb 2010, at 18:17, Rainer Stratmann wrote:
> > In the past with the turbopascal compiler and other always sizeof
> > byte was
> > added.
>
> That is not true. This program prints "2" when compiled under Turbo
> Pascal:
Ok, sorry I don't remember exactly, but it feels like that tp did this.
Is there a site how to deal with pointers?
> {$t-}
>
> type
> pw = ^word;
> var
> w: pw;
> begin
> w:=nil;
> inc(w);
> writeln(longint(w));
> end.
>
> (and the result does not depend on {$t+} or {$t-}; that only
> influences whether e.g. @wordvar has the type "^word" or plain
> "pointer").
>
> Furthermore, Turbo Pascal did not support performing pointer
> arithmetic using anything else but inc() and dec() (so things like
> "ppp := ppp + http.header_anz" or "w:=w+1" would not compile under
> TP), except for pchar variables (in which case the base value is
> sizeof(char), since that's what a pchar points to).
>
>
> Jonas
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list