Is there some sort of advantage to using int over short or long? It seems to me (right now) it just causes confusion.
None should be used, you should use int32, uint32, int16, etc.
You should use int when you want an integer. The compiler will give you the size that is most efficient to use on your current architecture.
But if you were writing the same file on 2 computers that are different, couldn't that cause some problems?
It depends how you're using it.
"for(int i = 0; i < 100; i++)" - using whichever is most efficient would make more sense.
Quote from: Adron on March 25, 2004, 08:58 PM
You should use int when you want an integer. The compiler will give you the size that is most efficient to use on your current architecture.
Note that CL defines
int as 32-bit on x86-64 and IA-64.
Quote from: Skywing on March 26, 2004, 06:52 PM
Note that CL defines int as 32-bit on x86-64 and IA-64.
That's a strange thing. Int grew from 16-bit to 32-bit, but it's not growing to 64-bit on the intel architectures, only on real 64-bit machines?
Quote from: Adron on March 27, 2004, 06:26 AM
Quote from: Skywing on March 26, 2004, 06:52 PM
Note that CL defines int as 32-bit on x86-64 and IA-64.
That's a strange thing. Int grew from 16-bit to 32-bit, but it's not growing to 64-bit on the intel architectures, only on real 64-bit machines?
Microsoft decided against it for their compiler because apparently too many programs used types like
int in files and such that would break compatibility. I think you are supposed to use __int64 for 64-bit ints.
Quote from: Skywing on March 26, 2004, 06:52 PM
Quote from: Adron on March 25, 2004, 08:58 PM
You should use int when you want an integer. The compiler will give you the size that is most efficient to use on your current architecture.
Note that CL defines int as 32-bit on x86-64 and IA-64.
Lol?
Quote
Note that CL defines
int as 32-bit on x86-64 and IA-64.
Quote
I'm a newbie - std::cout << sizeof(int) << " bytes.\n";
std::cout << sizeof(long) << " bytes.\n";
little bytes :P
Quote from: Nath on April 10, 2004, 12:12 PM
Quote
Note that CL defines int as 32-bit on x86-64 and IA-64.
Quote
I'm a newbie - std::cout << sizeof(int) << " bytes.\n";
std::cout << sizeof(long) << " bytes.\n";
little bytes :P
yes indeed you are a newbie -- you made two quotes without them saying anything...
Also, to avoid being annoying (not saying that you are, but doing it a jillion times makes it annoying), try and use the "Modify" feature rather than posting several times in a row.
Also, use the [ code ] [ /code ] tags to ensure proper formatting.