Unidata / netcdf-cxx4

Official GitHub repository for netCDF-C++ libraries and utilities.
Other
126 stars 49 forks source link

2 * field not copied in copy constructor ? #125

Open dcb314 opened 2 years ago

dcb314 commented 2 years ago

ncCompoundType.cpp:44:17: warning: Member variable 'NcCompoundType::myOffset' is not initialized in the copy constructor. [uninitMemberVar]

ncType.cpp:36:9: warning: Member variable 'NcType::g_fileId' is not initialized in the copy constructor. [uninitMemberVar]

ZedThree commented 2 years ago

These are both unused private members and could be deleted entirely.

NcType::g_fileId looks like it was replaced by a global variable, g_ncid, to work round some issue -- I think because a type might be defined in a group, and a few functions need the file ID, and there's no existing method to get the file ID from a group ID. That is presumably possible to do by repeatedly getting the parent ID until hitting the root.

It looks like NcType can also be constructed from a "global type", and it seems like the C library has no way of getting a type's parent ID for some reason.