Results 1 to 1 of 1
Dear All, Could anybody provide me information on how to get 64 bit specific warnings on SUSE Linux 64 bit machine. I am trying to port 32 bit code to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-02-2009 #1
- Join Date
- Feb 2009
Help needed for 64 bit porting warnings (specially for lon to int truncation)
Could anybody provide me information on how to get 64 bit specific warnings on SUSE Linux 64 bit machine. I am trying to port 32 bit code to 64 bit machine. I am using gcc to build my code. On Solaris Platform doing "CC +w2 -xarch=v9" gives the desired warnings. Could anybody provide me similar things for Linux as the above mentioned flag for solaris are not working with gcc on Linux.
I have already tried -Wall -Wextra -Wmissing-prototypes -Wconversion -Wformat-Wshorten-64-to-32 and -pedantic, but none of these helped.
To check the appropriate flags for desired warnings I wrote a sample code which is as follows:
using namespace std;
unsigned long ul = -1UL;
unsigned int i = 20,j;
unsigned int *ip = &i;
i = ul;
j = (unsigned int) ip;
If I build the code on 64 bit machine I should get warnings for the following two lines:
i = ul;
j = (int) ip;
But when i copiled it with "gcc -c -m64 -Wall -Wmissing-prototypes" I am getting only one warning i.e. "warnings.cpp:11: warning: cast from pointer to integer of different size". I am not getting warning for long to int assignement for the line "i = ul;".
Could anybody suggest me something on this.
Thank you in advance.