- What is the difference between a 32-bit program and a 64-bit program?
- If I write code in a 64-bit OS in C ++ will this be a 64-bit program?
- How to write a 64-bit program?
2 answers
Size of long types and pointers (64 and 32 bits). In principle, a 64-bit program can directly access data in an address space larger than 4 gigabytes, while 32-bit can not. Sometimes 32-bit programs run faster (mainly due to the more economical use of the CPU cache). 64-bit programs cannot be executed on 32-bit machines, but vice versa is possible (but not always).
If the compiler is 64-bit, then yes.
Use 64-bit OS and 64-bit compiler.
- @avp, thank you so much ... - Alina_Klimova September
- 3Specification to 2 - if the compiler is able to generate 64-bit code. And he himself may be at least eight-bit. - insolor
- one@avp, on item 3: you can compile a 64-bit program in a 32-bit OS if the compiler can generate 64-bit code (I know such examples). Another thing is that you will not launch such a program on this OS))) - skegg
- Sure you may. Even for a different processor. You know that for sure, and for a vehicle, such things are called cross compilation . I just decided not to go deep into the topic (I answered at night), to dwell on the practically important for a beginner (how well it turned out, I don’t know). - avp
What is the difference between a 32-bit program and a 64-bit program?
This is determined by your compiler and the fact that it decides to change in the properties of the C ++ platform when switching between the 32-bit and 64-bit configurations. The size of all pointer types usually changes. The sizes of fundamental integral types, etc. can also change.
If I write code in a 64-bit OS in C ++ will this be a 64-bit program?
Not. Your OS here does not matter at all. Everything is determined only by the compiler and its settings.
How to write a 64-bit program?
??? Just like the 32-bit program. Sit down and write. Nothing else, like, until they came up.