Author |
Message |
help! Guest
Offline
|
Posted: Thu Feb 19, 2004 6:34 pm Post subject: types |
 |
|
|
|
why did catid make so many different numeric types of data structures ie:Uint32.. etc ? why wouldnt a simple int work... thanx in advance |
|
Back to top |
|
 |
ExplodyThingy Server Help Squatter
Age:38 Gender: Joined: Dec 15 2002 Posts: 528 Location: Washington DC Offline
|
Posted: Thu Feb 19, 2004 6:49 pm Post subject: |
 |
|
|
|
Because, its smaller and more effective. _________________ There are no stupid question, but there are many inquisitive idiots.
Loot
Dr Brain> I hate clean air and clean water. I'm a member of Evil Conservitive Industries |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Thu Feb 19, 2004 6:50 pm Post subject: |
 |
|
|
|
Well, it's a major pain when you want to type 'unsigned blah' over and over again. And the reason it can't just be signed is because numbers can go over the halfway point of an int in SS, causing them to be negative. Basically, it's just a lot cleaner (and more secure) to keep unsigned numbers unsigned. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Thu Feb 19, 2004 7:46 pm Post subject: |
 |
|
|
|
Uint32, etc are usually macro-defined shortcuts for types in (usually) c-likelanguages, among others.
The problem with packaged ints is that they may use much more space than is necessary.
For instance, a built-in integer for any given language may be 32 bits, which then supports (correct me if im wrong) positive and negative integers with absolute value of 512.
However, what if i need values up to 1000? setting a uint32 (unsigned int 32 bits) gets me ONLY positive number support up to 1024.
int x = 1020; //error
uint32 y = 1020; //ok
|
also, shorthand primitives may be used to save space, as in using only a sint16 (signed integer 16 bits) rather than just an int (which 16 unnecessary bits);
for(int x=0;x<=200;x++){
int y = x; //memory waste!
sint z = d; //thats a little better
}
|
once again, i didn't check my math here (i shouldknow it by heart), so please take the literals only as stand-in placeholders _________________ Signatures just seem so quaint. |
|
Back to top |
|
 |
Dr Brain Flip-flopping like a wind surfer

Age:39 Gender: Joined: Dec 01 2002 Posts: 3502 Location: Hyperspace Offline
|
Posted: Thu Feb 19, 2004 8:13 pm Post subject: |
 |
|
|
|
32 bits gives a helluva lot more room than +-512. _________________ Hyperspace Owner
Smong> so long as 99% deaths feel lame it will always be hyperspace to me |
|
Back to top |
|
 |
Helicon Server Help Squatter
Joined: Dec 03 2002 Posts: 771 Location: GNU Doldrums Offline
|
Posted: Thu Feb 19, 2004 9:25 pm Post subject: |
 |
|
|
|
msdn wrote: | The Int32 value type represents signed integers with values ranging from negative 2,147,483,648 through positive 2,147,483,647.
|
|
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Thu Feb 19, 2004 10:24 pm Post subject: |
 |
|
|
|
Except you use UInt which is... double that. |
|
Back to top |
|
 |
|