Object Pascal offers two different sorts of consts: 'proper' consts that are constant (as you might expect), and typed consts that are initialized variables. Naming the latter sort 'const' is a frequent source of confusion for newcomers to Pascal, but it was introduced by Borland, and FPC preserves the same syntax for compatibility with Delphi.
The constant sort of const is always declared using
const
identifier = value;
without a type. The compiler assigns an appropriate type automatically, although you can override the compiler's choice of type by using a typecast in the declaration. But most situations do not need that level of control over the type of a const.
The initialized variable sort of const, declared using
const
identifier: type = value;
and most often termed a typed constant will always declare an initialized variable (in spite of the const declaration name).
It is possible to treat this initialized variable always as constant by using the compiler directive
{$J-} or {$WRITEABLECONST OFF}
Then if you inadvertently assign a new value to your const, the compiler will stop with an error pointing out that you wanted that value to be constant. It is internally still an initialized variable.
For Delphi compatibility the FPC default setting is {$J+}, which means that unless you change the default all typed constants you declare are writeable.
Because typed constants are not true constants the compiler disallows their use where true constants are required (such as in setting the bounds of a static array).