Reputation: 942
I've recently formatted my computer and re-installed Ubuntu and Eclipse. Afterwards, when I opened a C++ project that was both warning and error free, Eclipse now shows me some warnings I've never seen before, such as:
Macro definition can be replaced with constexpr expression
and
Un- or ill-initialized variable found
Screenshot:
What do these warnings mean and why are they listed? They weren't there before I re-installed Ubuntu and Eclipse...
Thanks!
Upvotes: 1
Views: 1910
Reputation: 1053
Macro definition can be replaced with constexpr expression
This means, that you've used a preprocessor macro for defining a constant. You should replace this by a C++ const expression, i.e. replace #define PI 3.141
by const double PI = 3.141;
.
Un- or ill-initialized variable found
That's pretty much self-explanatory. Always initialize your variables or you will get undefined behaviour.
The reason why the warning appear is probably that the new Ubuntu version you installed comes with a newer version of GCC which reports more warnings than the previous one. Another explanation would be that you are using other compiler options than before, for example -Wall
.
Upvotes: 3