notbad
notbad

Reputation: 2877

How can I get g++ to issue a warning when converting int64_t to int?

I use this command to compile the code below:

g++  -ansi -pedantic -Wall -Wextra myfile.cpp

I want to get a warning int64_t is converted into int. But there is no any warning at all. How can I achieve this?

My g++ version is 4.6.1.

//file:myfile.cpp
#include <iostream>
using namespace std;
int main()
{
    int64_t yy = 10;
    int size = yy;
    cout << size << endl;
}

Upvotes: 4

Views: 291

Answers (1)

janneb
janneb

Reputation: 37188

Try -Wconversion; due to the large amount of noise this warning tends to produce, it's not part of -Wall

Upvotes: 10

Related Questions