NetCDF4 C++ API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Type sizes on various platforms and compilers
File:    TypeSizes.txt
Subject: NetCDF 4 C++ API -- Type sizes on various platforms + compilers
Author:  Thomas E. Hilinski <tom.hilinski@colostate.edu>
         Natural Resource Ecology Laboratory, Colorado State University
Date:    24/01/13

— netCDF 4.x types —

netCDF type  CDL type  bytes      description                              numeric limits
NC_BYTE      byte      size = 1   signed 1 byte integer (alias schar)      -128 to 127
NC_UBYTE     ubyte     size = 1   unsigned 1 byte integer                  0-255
NC_CHAR      char      size = 1   ISO/ASCII character                      0-255
NC_SHORT     short     size = 2   signed 2 byte integer                    -32768 to +32767
NC_USHORT    ushort    size = 2   unsigned 2 byte integer                  0-65536
NC_INT       int       size = 4   signed 4 byte integer                    -2147483648 to 2147483647
NC_UINT      uint      size = 4   unsigned 4 byte integer                  0-4294967296
NC_FLOAT     float     size = 4   single precision floating point number   -3.4028e38 to 3.4028e38
NC_DOUBLE    double    size = 8   double precision floating point number   -1.7977e308 to 1.7977e308
NC_INT64     int64     size = 8   signed 8 byte integer                    +/-(2^63 - 1)
NC_UINT64    uint64    size = 8   unsigned 8 byte integer                  0 to 2^64
NC_STRING    string    size = 4   variable length string of characters

— g++ 4.x on Intel CPU Linux and Cygwin —

netCDF type  C/C++ type           bytes      description
NC_BYTE      signed char          size = 1   signed 1 byte integer
NC_UBYTE     unsigned char        size = 1   unsigned 1 byte integer
NC_CHAR      unsigned char        size = 1   ISO/ASCII character
NC_SHORT     short                size = 2   signed 2 byte integer
NC_USHORT    unsigned short       size = 2   unsigned 2-byte integer
NC_INT       int                  size = 4   signed 4 byte integer
NC_UINT      unsigned int         size = 4   unsigned 4-byte integer
NC_FLOAT     float                size = 4   single precision floating point number
NC_DOUBLE    double               size = 8   double precision floating point number
NC_INT64     long long            size = 8   signed 8-byte int
NC_UINT64    unsigned long long   size = 8   unsigned 8-byte int
NC_STRING    char**               size = 4   pointer to C string

— g++ 4.x on Cray XT —

netCDF type  C/C++ type           bytes      description
NC_BYTE      signed char          size = 1   signed 1 byte integer
NC_UBYTE     unsigned char        size = 1   unsigned 1 byte integer
NC_CHAR      unsigned char        size = 1   ISO/ASCII character
NC_SHORT     short                size = 2   signed 2 byte integer
NC_USHORT    unsigned short       size = 2   unsigned 2-byte integer
NC_INT       int                  size = 4   signed 4 byte integer
NC_UINT      unsigned int         size = 4   unsigned 4-byte integer
NC_FLOAT     float                size = 4   single precision floating point number
NC_DOUBLE    double               size = 8   double precision floating point number
NC_INT64     long long            size = 8   signed 8-byte int
NC_UINT64    unsigned long long   size = 8   unsigned 8-byte int
NC_STRING    char**               size = 8   pointer to C string