Pointer arithmetics, automatic `uses'_(re)

Fri, 24 Oct 1997 01:14:53 +0200 (MEST)


According to The African Chief:
>
> This is getting very interesting :-) We now have many different
> versions of FillChar! Which should I use?

One that works, and among those the fastest one.

> > BTW, pointer arithmetics ... should GPC allow constructions like
> > 
> >     (*$X+*)
> > 
> >     Var
> >       p, q: ^Char;
> > 
> >     p:= q + 42;
> > 
> > or only
> > 
> >     p:= succ ( q, 42 ); ?
> > 
> > Personally, I would prefer to allow only the second (Pointer being an
> > ordinal type) and to consider the first (Pointer + Integer) an error,
> > but it's technically easier to allow both, so I ask before I remove a
> > bug somebody might consider a feature. ;-)
> 
> Personally, I would keep both. I am not in favour of imposing
> restrictions on programmers, unless it is for their own good! I
> suppose we could assume that anyone who wants to use the first
> permutation knows what he/she is doing.

One "pro" for keeping both is that "Pointer - Pointer" yields an Integer,
so "Pointer + Integer" should work too and act as a reverse of the first.

> PS: - another point entirely; is there a switch that will enable
> a particular unit (in this case SYSTEM.PAS) to be used
> automatically, without putting it manually in the USES clause of
> every source file? I am looking for something like 
> 
> "--auto-use=xxx.pas,yyy.pas,f:\gpc\zzz.pas", 
> 
> which I can then use from the command line, or put into to
> GPCC.CFG file.

This is planned, and `--auto-use=...' is a good suggestion for the name.
Okay with everybody?  (Or perhaps `--auto-uses=...'?  Or just `--uses=...'?)

    Peter

 Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [971005]
 maintainer GNU Pascal [971001] - http://home.pages.de/~gnu-pascal/ [971005]


Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es