porting to 64 bit

N

nprashanth

Hi,

I've to port some code to a 64 bit platform (RedHat AS4). I was looking
for some compiler switches which can flag errors like this:

bash-3.00$ cat test.cpp
#include <string>

int main()
{
//unsigned long int being assigned to an unsigned int
unsigned xyz = std::string("").find("A");
}

I used some options, but they do not seem to flag the error:
bash-3.00$ g++ -c -Wconversion -Wimplicit -Wall -Wextra -m64 test.cpp
test.cpp: In function `int main()':
test.cpp:7: warning: unused variable 'xyz'

version: gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)

Are there any options which can flag such errors? If no, is there any
way to find such errors?

Thanks for your time,
Prashanth.
 
N

noone

Hi,

I've to port some code to a 64 bit platform (RedHat AS4). I was looking
for some compiler switches which can flag errors like this:

bash-3.00$ cat test.cpp
#include <string>


better to look for your answer in the gnu gcc forums
 
O

Ondra Holub

(e-mail address removed) napsal:
Hi,

I've to port some code to a 64 bit platform (RedHat AS4). I was looking
for some compiler switches which can flag errors like this:

bash-3.00$ cat test.cpp
#include <string>

int main()
{
//unsigned long int being assigned to an unsigned int
unsigned xyz = std::string("").find("A");
}

I used some options, but they do not seem to flag the error:
bash-3.00$ g++ -c -Wconversion -Wimplicit -Wall -Wextra -m64 test.cpp
test.cpp: In function `int main()':
test.cpp:7: warning: unused variable 'xyz'

version: gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)

Are there any options which can flag such errors? If no, is there any
way to find such errors?

Thanks for your time,
Prashanth.

In any project is good approach to:
- turn on all warnings
- make code review (by other people who are not authors of code)
- use tools like valgrind or lint to check the code
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top