Unidata / netcdf-cxx4

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

const return values #41

Open julietbravo opened 7 years ago

julietbravo commented 7 years ago

With Intel 17.0.0, I'm getting warnings like:

ncDim.h(47): warning #858: type qualifier on return type is meaningless
const int getId() const {return myId;};

for every include of <netcdf>. Is there any reason why a const int is returned instead of a int?

DennisHeimbigner commented 7 years ago

The compiler is correct. The const qualifier is only meaningful on pointers or structs. Primitive types like int char float are immutable by nature.

julietbravo commented 7 years ago

Are there any plans to fix this? I hate unnecessary warnings as they tend to hide other more important problems/warnings.

WardF commented 7 years ago

I can't test a fix for Intel because I don't have access to the intel compiler but it seems straight-forward. I'll make the change (most likely early next week) and hopefully that will fix things!

-Ward

julietbravo commented 7 years ago

Great, thanks in advance. Let me know if I can test anything with Intel.

WardF commented 7 years ago

I've updated the header file and code; let me know if I've missed something, otherwise I'll close this out shortly. You can test using the master branch, and I will being preparing the 4.3.1 release for sometime in the near future.