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
for:
int i =0;
int f = 3.14;
i = f;
warning: conversion to ‘int’ alters ‘double’ constant value [-Wfloat-conversion]
Some useful warning that I use always:
-Wall -Weffc++ -Wextra -pedantic -Wfatal-errors -pedantic-errors