02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>HP</strong> <strong>Fortran</strong> statements<br />

STRUCTURE (extension)<br />

STRUCTURE /sixbytes/<br />

INTEGER(KIND=2) :: twobytes<br />

CHARACTER(LEN=4) :: %FILL<br />

END STRUCTURE<br />

%FILL can be of any type and may appear more than once in a structure.<br />

%FILL should not be needed in normal usage. The compiler automatically adds padding to<br />

ensure proper alignment.<br />

Nested structures<br />

A field-def can itself be a structure definition, known as a nested structure. The syntax of a<br />

nested structure definition is:<br />

STRUCTURE /struct-name/struct-field-list<br />

field-def<br />

...<br />

END STRUCTURE<br />

struct-name is the structure’s name (delimited by slashes), which can be used later to<br />

declare a record.<br />

struct-field-list is a comma-separated list of one or more names of nested structure field<br />

names.<br />

field-def can be one of the following regular field definitions (defined in the same way<br />

as an unnested structure field):<br />

434<br />

A type declaration statement<br />

Another nested structure<br />

A nested record<br />

A union definition<br />

NOTE Note that a structure definition allows multiple levels of<br />

nesting.<br />

A nested structure definition is the same as an unnested structure definition, with two<br />

exceptions:<br />

/struct-name/ is optional in a nested structure.<br />

A nested structure definition must include a list of one or more structure field names<br />

(struct-field-list).<br />

Chapter 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!