Node:attribute, Next:begin, Previous:Assigned, Up:Reference
(Under construction.)
declaration attribute (name);
or
declaration attribute (name = parameter);
or
declaration attribute (name (parameter, parameter ...));
Several attributes can be given in one attribute
directive,
separated with ,
, or in several attribute
directives.
Besides the attributes that GCC supports (see Attribute Syntax), GPC allows the following attributes for variables:
For routines it allows the following additional attributes:
For types it allows the following additional attributes:
Size
can be applied to integer and Boolean types to produce
types with a specified size in bits; for example
type Card16 = Cardinal attribute (Size = 16);
defines an unsigned integer type with 16 bits.
Variable and routine attributes are preceded by a ;
, type
attributes are not. So, e.g., in the following example, the
Size
attribute applies to the type, and the static
attribute to the variable.
var a: Integer attribute (Size = 64); attribute (static);
attribute
is a GNU Pascal extension.
program AttributeDemo; { Demo for `iocritical' attribute. } { Program will abort with a runtime error! } {$I-} procedure p; attribute (iocritical); var t: Text; begin Reset (t) { Will not cause a runtime error here because I/O checking is off, but leave InOutRes set. } end; {$I+} begin p; { Since `p' was declared `iocritical', and I/O checking is now on, InOutRes is checked immediately after the call to p, and a runtime error raised. } { So this statement is never reached. } InOutRes := 0; { Neither this one, which would be reached without the `iocritical' attribute. } WriteLn ('never gets here') end.