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 Sjur, Does the problem you reported a long(!) time ago with as_double() still occur, and if so do you have a little example program that demonstrates the bug? I think the lack of an example of the bug is why it's still open. --Russ > > I've come across two apparent properties of the as_double() function in the > > NetCDF C++ interface: > > 1: as_double() does not check for data_mode, and creashes if the file is in > > definition mode > > 2: as_double() does not check for dimension limits, returning whatever is > > in the calculated memory location. > > > > Are these checks left out intentionally to save time, or would it be > > advantageous to have them? Considering that the function allocates and > > deallocates memory on the fly, the extra time to perform these checks > > should not be dramatic. > > > > NetCDF 4 on Windows, precompiled C interface dll. > > Thanks for reporting this problem. I assume you are reporting > the problem with the old netCDF-3 C++ interface in the cxx/ source > directory rather than the experimental (and incomplete) netCDF-4 > interface in the cxx4/ source directtroy, but the problems may be in > both. A user is currently working on completing the cxx4/ interface > and upgrading it to make use of more modern C++ idioms, exceptions, > templates, and name spaces. > > The C++ interface was designed so that > > * No explicit nc_redef or nc_endef calls are needed for switching between > define and data modes. Whenever a mode switch is required, it happens > implicitly. > > so if that's not working when as_double() is invoked, it's a bug. Also > as_double(n) should return a fill value when n is out of range, so that > also looks like a bug. We'll try to get them fixed before the next release. > > Thanks for reporting the problems! > > --Russ > > > Russ Rew UCAR Unidata Program > address@hidden http://www.unidata.ucar.edu > > Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: BIE-294861 Department: Support netCDF Priority: Critical Status: Closed