Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c++

linux

x86

g++

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;
}
like image 208
notbad Avatar asked Sep 16 '25 18:09

notbad


1 Answers

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

like image 90
janneb Avatar answered Sep 19 '25 09:09

janneb