473,856 Members | 1,559 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Integer Do's And Don'ts

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 there a way to remove the ones with size predefined from the
autolisting of types when I am declaring something?
--
To Email Me, ROT13 My Shown Email Address

Nov 21 '05
61 3409

"Herfried K. Wagner [MVP]" <hi************ ***@gmx.at> wrote
The choice of a data type should /not/ be made with the processor
architecture and hardware features in mind, instead it should be made based
on the context of the programming problem that should be solved.


That is in opposition to the advice that says loop counters, especially
those that need performance, should be of the native type to the system.

So many rules, so little time...

<g>
LFS
Nov 21 '05 #21
"Herfried K. Wagner [MVP]"
The choice of a data type should /not/ be made with the processor
architecture and hardware features in mind, instead it should be made
based
on the context of the programming problem that should be solved.


http://www.hut.fi/Misc/cbm/

You are your whole live with the 32bit computer I see as some people stayed
there whole live with this computer above

This are not the types where I had to start programming with by the way that
were this ones
http://www.liceofoscarini.it/didatti...lo/ibm360.html

You can read Italian so that will not be a problem. (I thought that I
started with a 8Kb one)

Cor

Nov 21 '05 #22
Larry,

Future will tell, however in my opinion holds an Integer a complete word.

For me does that means a complete register word from the processor what is
the best format to use in a computer for calculations because there is not
any extra processing needed.

In my idea are you mixing that up with a byte, a byte is a format as it is
used in memory or on disk.

Cor
Nov 21 '05 #23
"Larry Serflaten" <se*******@usin ternet.com> schrieb:
The choice of a data type should /not/ be made with the processor
architecture and hardware features in mind, instead it should be
made based on the context of the programming problem that
should be solved.


That is in opposition to the advice that says loop counters, especially
those that need performance, should be of the native type to the system.


So we need to update our code every time there is a technology shift....

\\\
#If Is64BitSystem Then
Dim i As Long
#Else
Dim i As Integer
#End If
For i = 1 To 10
...
Next i
///

.... or...

\\\
If System.Is64Bit Then
For i As Long = 1 To 10
...
Next i
Else
For i As Integer = 1 To 10
...
Next i
End If
///

Reminds me of weird C++ code that needs to be run on multiple hardware/os
platforms...

SCNR

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #24

"Cor Ligthert" <no************ @planet.nl> wrote
In my idea are you mixing that up with a byte, a byte is a format as it is
used in memory or on disk.


And if an Integer is 2 bytes, and a Long 4 bytes, as was the case in VB6,
isn't that also a decription of their format? A lot of developers thought so....

LFS
Nov 21 '05 #25
John,
In addition to the other comments.

VB.NET has defined Integer to be an alias for System.Int32. With VS.NET 2005
64-bit edition (currently in beta, due out later in 2005), VB.NET has
defined Integer to be an alias for System.Int32, I would not worry about the
size of Integer "magically" changing as it did from VB6 to VB.NET.

I do as Herfried does for purely managed code I use Integer, Short, Long.

When I am declaring interfaces & methods used in COM & Win32 Interop I will
use the more explicit Int32.

Hope this helps
Ja

"John Baker" <wb********@wzw freivprf.pbz> wrote in message
news:Sy******** *********@fe1.c olumbus.rr.com. ..
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 there a way to remove the ones with size predefined from the
autolisting of types when I am declaring something?
--
To Email Me, ROT13 My Shown Email Address

Nov 21 '05 #26
"Cor Ligthert" <no************ @planet.nl> schrieb:
Future will tell, however in my opinion holds an Integer a
complete word.
That may be true, but I think that is not what Larry and I are trying to
tell you. There are two different questions:

Q: Will an 'Int32' require 64 bits on a 64-bit system?
A: I assume that this will be the case, but I am not a hardware specialist.

Q: Will 'Integer' change its semantics on a 64-bit system?
A: Definitely no. An 'Integer' on a 64-bit system will have the same
range/number of representable numbers. The underlying hardware/system will
be completely transparent to the programmer, no changes in (managed) code
are required.
For me does that means a complete register word from the
processor what is the best format to use in a computer for
calculations because there is not any extra processing needed.


For me, a "word" is 16 bits, thus a VB.NET 'Integer' is a "dword", which
means that it's a 32-bit integer number.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #27
Herfried,

That may be true, but I think that is not what Larry and I are trying to
tell you. There are two different questions:

Q: Will an 'Int32' require 64 bits on a 64-bit system?
A: I assume that this will be the case, but I am not a hardware
specialist.
No of course not, I am talking about an Integer not an Int32 which describe
a special format.
Q: Will 'Integer' change its semantics on a 64-bit system?
A: Definitely no. An 'Integer' on a 64-bit system will have the same
range/number of representable numbers. The underlying hardware/system
will
be completely transparent to the programmer, no changes in (managed) code
are required.
This I said I will let now to the future
For me does that means a complete register word from the
processor what is the best format to use in a computer for
calculations because there is not any extra processing needed.


For me, a "word" is 16 bits, thus a VB.NET 'Integer' is a "dword", which
means that it's a 32-bit integer number.


I hope we both will see in future

:-)

Cor
Nov 21 '05 #28
Jay,

Nothing different than I wrote.

:-)

Cor
Nov 21 '05 #29
"Cor Ligthert" <no************ @planet.nl> schrieb:
That may be true, but I think that is not what Larry and I are trying to
tell you. There are two different questions:
[...]
Q: Will 'Integer' change its semantics on a 64-bit system?
A: Definitely no. An 'Integer' on a 64-bit system will have the same
range/number of representable numbers. The underlying
hardware/system will be completely transparent to the programmer,
no changes in (managed) code are required.


This I said I will let now to the future


There are already preview versions of the 64-bit version of the framework
available, and in these versions, 'Integer' maps to 'Int32', as it is
documented in the documentation for the 'Int32' type. There is absolutely
not reason to change the mapping between 'Integer' -> 'Int32' into
'Integer' -> 'Int64' for 64-bit system. This change would only have
disadvantages such as broken code.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #30

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

Similar topics

5
2735
by: Dan Gidman | last post by:
Well guys this may be the wrong place but an earlier post by an "expert" about how a table was poorly designed has piqued my interest. The question is this. What are the do's and don'ts of sql development? Please list what you consider to be good and bad practices in general and/or specific or list links to resources that would be considered under this topic. When I consider best practices myself of course there is always the...
0
9762
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10696
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10782
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10384
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9531
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7932
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5761
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3201
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.