CQMP / Maxent

GNU General Public License v2.0
16 stars 14 forks source link

silly warnings #19

Closed egull closed 7 years ago

egull commented 7 years ago

this is not urgent at all – next time we touch the code we should cleanup these silly warnings:

In file included from /Users/egull/Projects/Maxent/src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/src/maxent.hpp(24), from /Users/egull/Projects/Maxent/src/maxent.cpp(20): /Users/egull/Projects/Maxent/src/maxent_kernel.hpp(52): warning #858: type qualifier on return type is meaningless const kerneltype getKernelType() const{return ktype;} ^

In file included from /Users/egull/Projects/Maxent/src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/src/maxent.hpp(24), from /Users/egull/Projects/Maxent/src/maxent.cpp(20): /Users/egull/Projects/Maxent/src/maxent_kernel.hpp(54): warning #858: type qualifier on return type is meaningless const dataspacetype getDataspaceType() const{return dtype;} ^

In file included from /Users/egull/Projects/Maxent/src/maxent.hpp(24), from /Users/egull/Projects/Maxent/src/maxent.cpp(20): /Users/egull/Projects/Maxent/src/maxent_parms.hpp(54): warning #858: type qualifier on return type is meaningless const kernel_type getKernelType() const {return k_type; } ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/simulationTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(52): warning #858: type qualifier on return type is meaningless const kerneltype getKernelType() const{return ktype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/simulationTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(54): warning #858: type qualifier on return type is meaningless const dataspacetype getDataspaceType() const{return dtype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/simulationTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(54): warning #858: type qualifier on return type is meaningless const kernel_type getKernelType() const {return k_type; } ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/backcontTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(52): warning #858: type qualifier on return type is meaningless const kerneltype getKernelType() const{return ktype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/backcontTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(54): warning #858: type qualifier on return type is meaningless const dataspacetype getDataspaceType() const{return dtype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/backcontTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(54): warning #858: type qualifier on return type is meaningless const kernel_type getKernelType() const {return k_type; } ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/parmsTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(52): warning #858: type qualifier on return type is meaningless const kerneltype getKernelType() const{return ktype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/parmsTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(54): warning #858: type qualifier on return type is meaningless const dataspacetype getDataspaceType() const{return dtype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/parmsTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(54): warning #858: type qualifier on return type is meaningless const kernel_type getKernelType() const {return k_type; } ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/gridTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(52): warning #858: type qualifier on return type is meaningless const kerneltype getKernelType() const{return ktype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/gridTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(54): warning #858: type qualifier on return type is meaningless const dataspacetype getDataspaceType() const{return dtype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/gridTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(54): warning #858: type qualifier on return type is meaningless const kernel_type getKernelType() const {return k_type; } ^

In file included from /Users/egull/Projects/Maxent/src/maxent.cpp(20): /Users/egull/Projects/Maxent/src/maxent.hpp(161): warning #858: type qualifier on return type is meaningless const double getPostProb() const{return postprobdef;} ^

In file included from /Users/egull/Projects/Maxent/test/simulationTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent.hpp(161): warning #858: type qualifier on return type is meaningless const double getPostProb() const{return postprobdef;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/paramFailureTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(52): warning #858: type qualifier on return type is meaningless const kerneltype getKernelType() const{return ktype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(24), from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/paramFailureTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_kernel.hpp(54): warning #858: type qualifier on return type is meaningless const dataspacetype getDataspaceType() const{return dtype;} ^

In file included from /Users/egull/Projects/Maxent/test/../src/maxent.hpp(24), from /Users/egull/Projects/Maxent/test/paramFailureTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent_parms.hpp(54): warning #858: type qualifier on return type is meaningless const kernel_type getKernelType() const {return k_type; } ^

In file included from /Users/egull/Projects/Maxent/test/backcontTest.cpp(19): /Users/egull/Projects/Maxent/test/../src/maxent.hpp(161): warning #858: type qualifier on return type is meaningless const double getPostProb() const{return postprobdef;} ^

In file included from /Users/egull/Projects/Maxent/test/parmsTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent.hpp(161): warning #858: type qualifier on return type is meaningless const double getPostProb() const{return postprobdef;} ^

In file included from /Users/egull/Projects/Maxent/test/gridTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent.hpp(161): warning #858: type qualifier on return type is meaningless const double getPostProb() const{return postprobdef;} ^

In file included from /Users/egull/Projects/Maxent/test/paramFailureTest.cpp(20): /Users/egull/Projects/Maxent/test/../src/maxent.hpp(161): warning #858: type qualifier on return type is meaningless const double getPostProb() const{return postprobdef;}

ryanlevy commented 7 years ago

Can you post what any extra flags you have on/what compiler you're using?

egull commented 7 years ago

This is on osx. The CXX compiler identification is Intel 16.0.1.20151020 The flags are -O3 -g

the fix is to change const double getPostProb() const{return postprobdef;} to const double &getPostProb() const{return postprobdef;} or to double getPostProb() const{return postprobdef;}

...and analogously for the rest. Doesn't matter which one.

iskakoff commented 7 years ago

Actually it does matter, const double should be replaced only by double. Since const modifier for primitive types will give nothing it should be just removed. Replacing it with const double & give you a performance penalty for primitive types in general.

egull commented 7 years ago

got fixed some time ago.