472,353 Members | 1,194 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

VB.NET Integer data types

Is the Integer data type deprecated? I am not sure what Integer data type to
use in some of my classes.

According to the URL below, if I am reading it correctly, it seems as though
I should be using the Short, Integer, and Long data types. Is this correct?
Or should I instead be using the Int16, 32, and 64 data types in my code?
Whats the best practice here?

http://www.ondotnet.com/pub/a/dotnet...b7.html?page=2
Jul 21 '05 #1
3 17656
This has been debated a few times on the NGs.
In general, the consensus is to use the Short, Integer, and Long keywords.
They of course translate directly to the Int16, 32, and 64 data types.
The debate has mostly been "will the underlying type vary in the future?"
At some point, it probably will, just has it has changed now.
But that time isn't in the foreseeable future. Maybe when the standard
processor architecture is 128bit or something.

However, in the cases where you know you need a specific size, which is
usually limited to external API calls and I/O, then I prefer to explicitly
declare the size. For me, when I see a declaration of Int32, that tells me
that I know I need exactly 32 bits for some reason. While it is no different
than "Integer", it is more "explicit" and serves as a flag to me when
reading my code later on that it might not be safe to alter the size.

As far as platform dependence, .NET has given us the IntPtr (Integer
Pointer) type. This is the one you should pay attention to. The underlying
type can vary based on whether you are on a 32 or 64 bit platform. Clearly
it should be used for pointers.

Gerald

"Shawn Berg" <sh***@saeweb.com> wrote in message
news:eY*************@TK2MSFTNGP12.phx.gbl...
Is the Integer data type deprecated? I am not sure what Integer data type to use in some of my classes.

According to the URL below, if I am reading it correctly, it seems as though I should be using the Short, Integer, and Long data types. Is this correct? Or should I instead be using the Int16, 32, and 64 data types in my code?
Whats the best practice here?

http://www.ondotnet.com/pub/a/dotnet...b7.html?page=2

Jul 21 '05 #2
Even though I use C++ .NET, I am faced a similar situation. I find it easiest
to use the language-specific names(short, int, long) when decaring variables,
but if is need to use it in an array decaration I use the .NET-specific
names(Int16, Int32, Int64). That way it takes less time to type, since there
really is no difference between the 2. I hope this helps.
Jul 21 '05 #3
Shawn,

The integer should give you the most properiate processor format. (with the
most performance). For the windows 32 bits operating systems is that 32
bits.

As Gerald tells are there a lot of discussions in the newsgroups if the
integer should stay 32 bits.

In my opinion would mean that the developer of that language will be the
looser in time in my opinion.

Any format (larger or smaller) that does not fit the register format needs
more cycles to proccess.

I hope that this helps,

Cor
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: JKop | last post by:
When you want to store an integer in C++, you use an integral type, eg. int main() { unsigned char amount_legs_dog = 4; } In writing...
13
by: Shailesh Humbad | last post by:
I wrote a short page as a quick reference to c++ integer data types. Any feedback welcome: http://www.somacon.com/blog/page11.php
20
by: GS | last post by:
The stdint.h header definition mentions five integer categories, 1) exact width, eg., int32_t 2) at least as wide as, eg., int_least32_t 3) as...
61
by: John Baker | last post by:
When declaring an integer, you can specify the size by using int16, int32, or int64, with plain integer being int32. Is integer the accepted...
3
by: Shawn Berg | last post by:
Is the Integer data type deprecated? I am not sure what Integer data type to use in some of my classes. According to the URL below, if I am...
5
by: BobRoyAce | last post by:
Let's say I have a table called Users which has a field DeptID which is an int. I also have a User class which has a method for getting the data...
159
by: Bob Timpkinson | last post by:
Hi, I have a 32-bit machine... Is there anyway I can get gcc to use the following integer sizes? char: 8 bits short: 16 bits int: 32 bits...
130
by: euler70 | last post by:
char and unsigned char have specific purposes: char is useful for representing characters of the basic execution character set and unsigned char is...
12
by: lithiumcat | last post by:
Hi, I bothered you a while back about storing integer values in void*. Now in a completely unrelated context, I'm trying to store pointer values...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.