Next: , Previous: CDL Syntax, Up: NetCDF Utilities


5.2 CDL Data Types

The CDL data types are:

char
Characters.
byte
Eight-bit integers.
short
16-bit signed integers.
int
32-bit signed integers.
long
(Deprecated, currently synonymous with int)
float
IEEE single-precision floating point (32 bits).
real
(Synonymous with float).
double
IEEE double-precision floating point (64 bits).

Except for the added data-type byte and the lack of the type qualifier unsigned, CDL supports the same primitive data types as C. In declarations, type names may be specified in either upper or lower case.

The byte type differs from the char type in that it is intended for eight-bit data, and the zero byte has no special significance, as it may for character data. The ncgen utility converts byte declarations to char declarations in the output C code and to BYTE, INTEGER*1, or similar platform-specific declaration in output FORTRAN code.

The short type holds values between -32768 and 32767. The ncgen utility converts short declarations to short declarations in the output C code and to INTEGER*2 declaration in output FORTRAN code.

The int type can hold values between -2147483648 and 2147483647. The ncgen utility converts int declarations to int declarations in the output C code and to INTEGER declarations in output FORTRAN code. In CDL declarations integer and long are accepted as synonyms for int.

The float type can hold values between about -3.4+38 and 3.4+38, with external representation as 32-bit IEEE normalized single-precision floating-point numbers. The ncgen utility converts float declarations to float declarations in the output C code and to REAL declarations in output FORTRAN code. In CDL declarations real is accepted as a synonym for float.

The double type can hold values between about -1.7+308 and 1.7+308, with external representation as 64-bit IEEE standard normalized double-precision, floating-point numbers. The ncgen utility converts double declarations to double declarations in the output C code and to DOUBLE PRECISION declarations in output FORTRAN code.