Go to the first, previous, next, last section, table of contents.

Typed constants

GNU Pascal supports Borland Pascal's "typed constants" but also Extended Pascal's initialized variables:

  Var
    x: Integer value 7;

When a typed constant is misused as an initialized variable, a warning is given.

Initialization of structured variables (typed constants) is not yet stable.

When you want a local variable to preserve its value, define it as `__static__' instead of using a typed constant:

  Procedure Foo;

  Var
    x: __static__ Real;

  begin (* Foo *)
    (* x keeps its value between two calls to this Procedure *)
  end (* Foo *);

Remark: If you don't like underscores, you can use the (*$define *) mechanism to get rid of them:

  (*$define static __static__ *)

Go to the first, previous, next, last section, table of contents.