Reputation: 155
I have a couple of questions regarding x64 and x86 systems
I have written a C++ application in qt 4.7 , normally I use int for integers and so on.
So if I want to convert this application to x64bit what should I do?
should I just build it with different compiler options or should I change something in my code
another question if I download an open source application and build it in Linux what architecture would it be x64 or x86, I mean if I build the source in x64bit Linux I will get a x64 application and if I build the source in x86bit Linux I will get a x86 application
Upvotes: 0
Views: 582
Reputation: 730
Yes, you probably just need to recompile it. On (most?) 64-bit architectures, the size of an int is still 32-bit.
The answer to your second question is that, unless you tell the compiler otherwise, it will probably build for the platform you compile it on. Typing uname -m
will tell you which one that is.
Upvotes: 0
Reputation: 27365
The type of build should depends on the compiler and architecture you're building on.
That said, the code should be (should have been) written so that building with a different bit depth is supported.
For example, if you declare your integer variables using long
, the size of the variables will vary (depending on architecture). If you instead declare it using std::int32_t
or std::int64_t
, the size will be constant when switching between architectures.
Besides bit depth, you should also make sure any code that depends on endianness continues to run correctly (and there may be other factors to be careful about, besides bit depth and endianness).
In conclusion, it may be that you simply recompile your code on a new architecture and it works, or it may be that you will have to do some editing. I guess it depends on what your code does and how it's written.
Upvotes: 1