如何在代码块中启用缩小警告?

How to enable narrowing warnings in CodeBlocks?

我正在使用代码块编写 C++ 程序IDE

int main()
{
int i =0;
int f = 3.14;
i = f; //must give me a warning message, possible loss data.
}

为什么编译不显示缩小警告信息? 如何启用?

注意:我已将我的编译器选项固定为 -std=c++11 -Wall

其他编译器选项中放入-Wconversion

( code::block 16 )

用于:

int i =0;
int f = 3.14;
i = f;

warning: conversion to ‘int’ alters ‘double’ constant value [-Wfloat-conversion]


我经常使用的一些有用的警告:

-Wall -Weffc++ -Wextra -pedantic -Wfatal-errors -pedantic-errors