[fpc-pascal] Initializers on const and var

Marc Santhoff M.Santhoff at t-online.de
Tue Jun 3 11:21:58 CEST 2008


Hi,

is it possible to have an array initialized with variables?

I tried sth. like this (by accident, not intentionally):

const
	ctypes: array [0..9] of hid_t =
	(
		H5T_NATIVE_INT, H5T_C_S1, H5T_C_S1, H5T_C_S1, H5T_C_S1,
		H5T_C_S1, H5T_C_S1, H5T_C_S1, H5T_NATIVE_HBOOL, H5T_NATIVE_HBOOL
	);

assuming the names in upper case are constants. But in fact they are
variables (declared "cvar; external" but I think that's not the cause of
the error).

var
	H5T_NATIVE_INT: hid_t;
	...
	H5T_NATIVE_INT_g : hid_t;cvar;external;

initialization
	H5T_NATIVE_INT := H5T_NATIVE_INT_g;

The compiler does find an "illegal expression" after the first item in
the initializer.

Is there another way but moving the initialization from the interface to
the implementation of some "procedure init"? I'd like to see the
declaration in the interface part.

TIA,
Marc





More information about the fpc-pascal mailing list