64 Bit Compadibility?

This is a discussion on 64 Bit Compadibility? within the C++ Programming forums, part of the General Programming Boards category; Most of my code is simple C++ console utils, using stl components that compile fine between most OS's. Im wondering ...

  1. #1
    That Creepy Network Guy DeepBlackMagic's Avatar
    Join Date
    Feb 2003
    Posts
    265

    64 Bit Compadibility?

    Most of my code is simple C++ console utils, using stl components that compile fine between most OS's. Im wondering what type of complications i can expect to deal with should i try and compile and run my software on a 64bit pooter. Any input? Thanks guys.

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    If your code makes any assumptions about the size of data types (i.e. the maximum integer value), then it will run into trouble. If it does not need to make such assumptions, or accounts for possible differences (checking numerical limit values, using arbitrary precision number packages, etc), then it will not be affected.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #3
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    I would think most problems would not be in your code but in the compiler because most compilers (if not all) are platform/family specific. Like
    for gcc for example you can get
    i386 (runs on almost all intel familys)
    i586
    and i686 (correct me if im wrong)
    and then they have one for SPARC etc.

    and I believe... that the code on a 64bit system would compile fine (unless something like the above post happens) proveded that the compiler is equipped to handle the environment on this system.

    These are assumptions based off what I have learned, so correct me if i'm wrong anywhere.

    -LC
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  4. #4
    That Creepy Network Guy DeepBlackMagic's Avatar
    Join Date
    Feb 2003
    Posts
    265
    Im worried about math as well. If i perform division or another operation with certain significant figures, decimal places might go out more digits, and later on when i round, the answers between a 64bit and 32bit system might differ. Things of this nature are concieveable right?

  5. #5
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    well 64bit systems can run 32bit modes so technically all of the above shouldn't matter at all.

    -LC
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  6. #6
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    If your worried about such problems, you can check the std::numeric_limits templated structure in <limits>. For foating point types, it tells you the size of the mantissa, minimum and maximum exponents, epsilon, etc. For integral types, it tells you number of bits, min and max, signed, etc. Most likely, you'd have more problems (perhaps not errors, but losses of expected precision) moving from 64-bits to 32-bits, not vice-versa.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  7. #7
    Comment your source code! Lynux-Penguin's Avatar
    Join Date
    Apr 2002
    Posts
    533
    ok here is my reasoning

    everything will run the same because the processor will simply use a 32 bit mode, you have to do special types of programming to take advantage of the 64bit modes and registers. very few compilers are equipped to handle this I think only gcc and MSVC++ 7 are the only two right now. If the are even able to do so. Very few things can access the 64bit registers etc. The CPU, I believe, will do most of that work for you. If you want I can write some C to ASM code here to show you that it won't make a difference, especially if you use a compiler that was designed for a 32bit system. It is only if your code is specifically designed for the 64bit system will it matter at all. The compiler doesn't know how to use the new registers and all the new capabilities so it just uses the old ones and thats fine. So don't worry about it ^_^

    -LC
    Asking the right question is sometimes more important than knowing the answer.
    Please read the FAQ
    C Reference Card (A MUST!)
    Pointers and Memory
    The Essentials
    CString lib

  8. #8
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Many compilers for other 64 bit platforms do take advantage of the 64-bit processors (e.g. MIPSPro). The thing is, if you use things such as INT_MAX instead of hard-coding values like 2^31-1 (as the max signed integer) or the the numeric_limits templates should you need them, you should be fine.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  9. #9
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398

    Smile C++ is PORTABLE !

    C and C++ are portable languages. If you write to the ANSI/ISO standard, you can compile you code for any platform for which you have a compliant compiler.

    Like Zack said, you can use <limits> if necessary. The standard does specify a minimum size for each type. (A char MUST hold at least 8 bytes, etc.)

    Most real-world programs will have non-standard code. I'm sure it's considered good-practice to put all of the non-standard code in separate modules... but if you're writing Windows programs 90 percent of it's going to be non-standard!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  2. 64 bit programs
    By learning in forum C++ Programming
    Replies: 17
    Last Post: 05-10-2007, 11:26 PM
  3. A Question About Unit Testing
    By Tonto in forum C++ Programming
    Replies: 2
    Last Post: 12-14-2006, 07:22 PM
  4. bit patterns of negtive numbers?
    By chunlee in forum C Programming
    Replies: 4
    Last Post: 11-08-2004, 07:20 AM
  5. Array of boolean
    By DMaxJ in forum C++ Programming
    Replies: 11
    Last Post: 10-25-2001, 11:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21