I'm writing c++ program using codeblocks IDE
int main()
{
int i =0;
int f = 3.14;
i = f; //must give me a warning message, possible loss data.
}
Why the compilation not show a narrowing warning message? How to enable that?
Note: I have fixed my compiler options as -std=c++11 -Wall
-Wconversion
– M.M Apr 17 '17 at 8:22i = {f};
, braced list enforces non-narrowing – M.M Apr 17 '17 at 8:22-Wall -Wextra
; IMO some warnings are more harmful than not as they complain about good code – M.M Apr 17 '17 at 22:50