|
-
Jul 21st, 2004, 10:12 AM
#1
Numeric data types
What is better to use in .net ?
Integer Vs Int32
Short Vs Int16
etc
-
Jul 21st, 2004, 10:44 AM
#2
Integers. Most CPUs are 32 bit, so each time you wish to do a calculation on a 32 bit value, the whole thing is pushed into the CPU register. where as using 16 bit, it either has to buffer it out, or wait for 2 of them before it deals with it.
Well, thats what I read anyway .
-
Jul 21st, 2004, 10:54 AM
#3
no that wasn't my question. Sorry maybe I wasn't clear
I meant what is more efficent to use
Integer
or
Int32
and
Short
or
Int16
-
Jul 21st, 2004, 11:05 AM
#4
I "believe" that the Integer is a wrapper for Int32, because Ive heard that on a 32 bit OS it uses an Int32 and that on a 64 bit uses it as an Int64. Ive never had the chance to try it.
As for short and Int16, I would have thought they are the same thing, but I know MS suggest you use Int16 as its the base .net name and Short is the VB shortcut. But at compile time I spose its the same thing.
If you find a better explaination do tell .
-
Jul 21st, 2004, 11:18 AM
#5
Just had a search, and it seems that the Integer is just mapped directly to Int32 currently, and that the Int64 thing is probly just a rumour .
So they are both the same, use what you prefer is the general reply.
-
Jul 21st, 2004, 11:42 AM
#6
Sleep mode
Integer is mapped to the base class Int32 . Whether you use Integer or Int32 , it will be converted to IL that says Int32 .
-
Jul 21st, 2004, 12:22 PM
#7
I wonder how many charact
Int32 is explicitly 4 bytes long.
Integer is not. It presently exists as a 32bit variable on today's framework. Not necessarily true 3 years from now. I guess it was to allow for expansion on to future OS's.... but as Pirate points out, in this framework, it seems to map to Int32.
But I don't have a 64bit OS to compile it on, or a future version of the framework to test it on, so...
http://blogs.msdn.com/duncanma/archi...4/06/4927.aspx
Last edited by nemaroller; Jul 21st, 2004 at 12:27 PM.
-
Jul 21st, 2004, 01:45 PM
#8
im not concerned so much with the int64 which is why i didnt mention it in the post.
Im just converting some VB6 classes and was wondering what data types I should use for my integers and longs if I should use short and integer or int16 and int32
-
Jul 21st, 2004, 04:06 PM
#9
-
Jul 21st, 2004, 04:14 PM
#10
I wonder how many charact
My advice... based off that msdn blog..
Use Integer in all cases unless you're going to be passing them as parameters to a Win32 API (or other libraries which explicitly expect a 4-bit Integer , and pass it an Int32 in those cases).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|