Pointer arithmetics (was: BPCOMPAT v1.10 -released!)_(re)

Thu, 23 Oct 1997 13:29:12 +0100


Peter Gerwinski wrote:
> 
> According to Frank Heckenbach:
> > Until a (more optimized) version
> > of them will be built in, here are some replacements (a bit slower, but
> > should be portable and generate no warnings): [...]
> 
> Pointer arithmetics is portable and can be used here to speed it up:
> 
>     Procedure FillChar ( Var Dest: Void; Count: Integer; C: Char );
> 
>     Var
>       DestArray: tCharArray absolute Dest;
>       z: ^Char;
> 
>     begin (* FillChar *)
>       for z:= @DestArray [ 0 ] to @DestArray [ Count - 1 ] do
>         z^:= C;
>     end (* FillChar *);

This is getting very interesting :-) We now have many different
versions of FillChar! Which should I use?

> (Similar for `move'.)
> 
> 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.

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.

Best regards, The Chief
--------
Dr. Abimbola A. Olowofoyeku (The African Chief) 
Email: laa12@keele.ac.uk
Author of: Chief's Installer Pro 4.01 for Win16 and Win32: 
  Winner of PC PLUS Magazine Gold Award (April 1995 U.K. edition)
  http://ourworld.compuserve.com/homepages/African_Chief/
 
ftp://ftp.demon.co.uk/pub/ibmpc/win3/apps/chief/pro/chief401.zip


The African Chief (laa12@keele.ac.uk)

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