Next: , Previous: Data Types in BP and GPC, Up: Borland Pascal

7.15 BP Procedural Types

In addition to BP's procedural types, GNU Pascal has pointers to procedures:

       FuncPtr = ^function (Real): Real;

The differences between procedure pointers and procedural types are only syntactical:

One can use both kinds in the same program, of course, though it is recommended to stick to one kind throughout to avoid maximum confusion.

GNU Pascal also supports Standard Pascal's procedural parameters (see Special Parameters).

Furthermore, GNU Pascal allows you to call even local procedures through procedural pointers, variables or parameters without reverting to any dirty tricks such as assembler (which is necessary in BP).

The differences between the various kinds of procedural types, pointers and parameters are demonstrated in the demo program procvardemo.pas. An example for calling local routines through procedural parameters can be found in the demo program iteratordemo.pas.