This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
Hi Joe,
Last week, in response to your question
> Which is preferred? NC_LONG or NC_INT?
I replied:
The C++ interface still supports the netCDF-2.4 typedef "nclong", which
was defined to be an int on most platforms but a long on a few.
We deprecated the use of "nclong" with the netCDF-3 release, but
unfortunately never updated the C++ interface to use NC_INT instead
of NC_LONG and "int" instead of "nclong".
I thought I had fixed this in a way that would keep backward
compatibility for our next release (3.4), but in researching your
question, I discovered some additional changes that need to be made.
The goal is to have interfaces overloaded for both int and long
instead of nclong.
For now, I'm afraid you'll have to use NC_LONG and cast (ugh) to
nclong to use the existing C++ interface for putting ints. If you
can wait a week or two, we may have a beta test version with the
necessary changes incorporated.
The changes to eliminate the necessity for using nclong casts or the
NC_LONG type are now available as a patch from the "Know Problems with
netCDF 3.3.1" page at
http://www.unidata.ucar.edu/packages/netcdf/known_problems.html#cxxnclong
in case you're interested.
--Russ
_____________________________________________________________________
Russ Rew UCAR Unidata Program
address@hidden http://www.unidata.ucar.edu