32 bit or 64 bit
Moderators - Reputation: 19226
Posted 17 July 2012 - 06:28 AM
Depends on the CPU architecture that your compiler is targeting. Regular, portable x86 code won't have the instructions/registers to do 64-bit ops in a single instruction; the compiler will have to use a few instructions to implement long long operations.
Does a 32 bit OS process code with 64 bit numbers (long, ulong) properly? I was under the impression that if you use 64bit operators, you need to run it on a 64bit OS.
Members - Reputation: 449
Posted 17 July 2012 - 07:09 AM
If you need the 64-Bit data size for a special purpose so you are bound to use them you can use the types from stdint.h
They are fixed in size across different environments. This way you need not to know how long or long long is realized within the used environment.
stdint.h is not part of the MS compilers. But there are some versions around in the net that work with MS.
Crossbones+ - Reputation: 2847
Posted 17 July 2012 - 08:53 AM
That's Linux though, and still experimental / half finished.
But there is a new ABI coming up that uses the 64-Bit extensions on 32-Bit code.
As for "32 or 64 bit", my opinion is that if you have to ask, then you can just stick with 32 bit. 64 bit operating systems allow running 32 bit code just fine. A few rare operations might be slightly more expensive, but pointers are only half the size (which makes a big difference).
If you do need 64 bits, then you already know (you've already run out of address space once), you need not ask.
You really only need 64 bit if you have a dataset of considerably more than a gigabyte or two that you wish to keep in memory (mapped or otherwise). Most programs work just fine with a "normal" 2GB address space (which can be 4GB at no extra cost under a 64 bit OS if you only set the appropriate flag in the executable).
Edited by samoth, 17 July 2012 - 08:54 AM.
Crossbones+ - Reputation: 5584
Posted 18 July 2012 - 05:27 PM
Still, with the proper portability conventions followed, producing both versions should be effortless and would allow the application to run on those old PowerPC models too
Guys, this is a mac application though, from what I can find there aren't any macs running OSX as 32 bit anymore apart from the old PowerPC models
Of course, if applying those conventions would take a rewrite, it's probably not worth the time so good point. +1
"The best comment is a deleted comment."