views:

334

answers:

1

What can I do with untyped pointers in Pascal? (Why untyped pointers are good?)

+3  A: 

In Borland family Pascal's, you can pass a typed pointer to a parameter of the untyped pointer type. IOW

procedure test (x:pointer);

will also accept pchar etc. This is particularly useful for lowlevel routines like e.g. a routine that moves data ( move() or searches a memory range for a certain value etc, compress a certain memory range etc).

Some people also name pointer arithmetic as a reason, but e.g. Delphi allows that on pchar too.

FPC and Delphi 2009+ even allow it on other types.

Marco van de Voort