473,487 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 17756
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
2322
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 portable C++ code, there should be only two factors that...
13
3652
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
9103
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 fast as possible but at least as wide as, eg.,...
61
3281
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 default in the programming community? If so, is...
3
293
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 reading it correctly, it seems as though I should be...
5
1967
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 for a particular user (i.e. User with specified ID)...
159
6105
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 long: 64 bits long long: 128 bits
130
6625
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 useful for representing the values of individual...
12
3257
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 in an integer type. So the basic question is,...
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7181
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4874
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3071
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.