Skip to main content
gamedev.net
🔒 Locked

Quick gcc question

Started by vNistelrooy 6 replies 450+ views
Original Post
vNistelrooy
vNistelrooy
Which integer data types are always 32-bit (like __int32) and which are 64-bit (like __int64) both on the 32-bit gcc compiler and the 64-bit compiler? Thanks.
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
dcosborn
dcosborn
AFAIK, GCC doesn't have an equivalent to __int*. If you're using C99, you can use int*_t. Also, I believe GCC maintains that long is 32 bits and long long is 64 bits across both processors, but I can't say for sure...
vNistelrooy
vNistelrooy
Ok thanks.
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
Evil Steve
Evil Steve
According to another user (Pouya), on his 64-bit machine, sizeof(int) was 4 (32-bits) and sizeof(long) was 8 (64-bits).
smart_idiot
smart_idiot
#include <stdint.h>int32_t signed_32_bit_integer;int64_t signed_64_bit_integer;uint32_t unsigned_32_bit_integer;uint64_t unsigned_64_bit_integer;


The 64 bit versions aren't actually required to be there if the compiler doesn't have a native type that can hold such a number (like an old 16 bit compiler), but you're probably safe.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other
vNistelrooy
vNistelrooy
Quote:
Original post by smart_idiot
*** Source Snippet Removed ***

The 64 bit versions aren't actually required to be there if the compiler doesn't have a native type that can hold such a number (like an old 16 bit compiler), but you're probably safe.


Thanks!!!

mov eax,DWORD PTR [smart_idiot]
mov ecx,DWORD PTR [eax+8] // Put rating in ecx
inc ecx
mov DWORD PTR [eax+8],ecx
"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
balla_the_king
balla_the_king
Quote:
Original post by Evil Steve
According to another user (Pouya), on his 64-bit machine, sizeof(int) was 4 (32-bits) and sizeof(long) was 8 (64-bits).
Now the question is, does this depend on what target machine you specify, or what machine you compile on.
Toolmaker
Toolmaker
It's depending on the machine you compile(More likely the compiler) it on. I mean, if it would be 32bit on one and 64bit on the other machine, your application would be rewriting itself!

sizeof() is done during compilation, and not during runtime.

Toolmaker
 

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.