porting to 64 bit

Discussion in 'C++' started by nprashanth@gmail.com, Jan 13, 2007.

  1. Guest

    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.
     
    , Jan 13, 2007
    #1
    1. Advertising

  2. noone Guest

    On Fri, 12 Jan 2007 21:02:43 -0800, nprashanth wrote:

    > 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
     
    noone, Jan 13, 2007
    #2
    1. Advertising

  3. Ondra Holub Guest

    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
     
    Ondra Holub, Jan 13, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,766
    Timothy Bendfelt
    Jan 19, 2007
  2. Replies:
    4
    Views:
    1,080
    Jim Langston
    Nov 17, 2005
  3. Replies:
    5
    Views:
    715
  4. Pallav singh
    Replies:
    0
    Views:
    346
    Pallav singh
    Apr 1, 2009
  5. Pallav singh
    Replies:
    5
    Views:
    397
    Jorgen Grahn
    Apr 3, 2009
Loading...

Share This Page