473,468 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Overflow without error?


Is there a way to prevent an overflow of a variable?
Or is the only(/best) way is to do a try-catch statement?

The idea is that i can have an integer (signed or unsigned)
that just keeps rolling over. 0000 to FFFF and back to
0000.

Thanks for all help.

Nov 20 '05 #1
8 866
Jamie,

There is no unsigned integer in VBNet

Cor
Is there a way to prevent an overflow of a variable?
Or is the only(/best) way is to do a try-catch statement?

The idea is that i can have an integer (signed or unsigned)
that just keeps rolling over. 0000 to FFFF and back to
0000.

Thanks for all help.

Nov 20 '05 #2
Hi,

Disable overflow checking option: Go to project properties dialog -
Configuration Properties/Optimizations. Check Remove integer overflow
checkes.

If you are using command line compiler, use /removeintchecks+ option.

"jamie" <an*******@discussions.microsoft.com> wrote in message
news:10****************************@phx.gbl...

Is there a way to prevent an overflow of a variable?
Or is the only(/best) way is to do a try-catch statement?

The idea is that i can have an integer (signed or unsigned)
that just keeps rolling over. 0000 to FFFF and back to
0000.

Thanks for all help.


Nov 20 '05 #3
No, but there is a uint16.
Okay so maybe it is a structure and doing math on it is a
little harder.... Details.. details..*sigh* :p
-----Original Message-----
Jamie,

There is no unsigned integer in VBNet

Cor
Is there a way to prevent an overflow of a variable?
Or is the only(/best) way is to do a try-catch statement?
The idea is that i can have an integer (signed or unsigned) that just keeps rolling over. 0000 to FFFF and back to
0000.

Thanks for all help.

.

Nov 20 '05 #4
Thanks :)
That should do the trick.
Nov 20 '05 #5
* "jamie" <an*******@discussions.microsoft.com> scripsit:
No, but there is a uint16.
Okay so maybe it is a structure and doing math on it is a
little harder.... Details.. details..*sigh* :p


Unsigned integer datatypes are not CLS compliant, so you should avoid to
use them. In VB 2005, full support for unsigned data types will be
available.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #6
Jamie,
Just be warned that option effects your entire project. Which is all
classes, forms, controls in your project.

Which may be much more then you need.

If I used the option, I would put a comment at the top of the respective
file, so as your successors know why you need the option set, and consider
isolating the respective file to the smallest assembly (class library)
possible.

Hope this helps
Jay
"jamie" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...
Thanks :)
That should do the trick.

Nov 20 '05 #7
* "jamie" <an*******@discussions.microsoft.com> scripsit:
No, but there is a uint16.
Okay so maybe it is a structure and doing math on it is a
little harder.... Details.. details..*sigh* :p


Unsigned integer datatypes are not CLS compliant, so you should avoid to
use them. In VB 2005, full support for unsigned data types will be
available.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
<URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #8
Jamie,
Just be warned that option effects your entire project. Which is all
classes, forms, controls in your project.

Which may be much more then you need.

If I used the option, I would put a comment at the top of the respective
file, so as your successors know why you need the option set, and consider
isolating the respective file to the smallest assembly (class library)
possible.

Hope this helps
Jay
"jamie" <an*******@discussions.microsoft.com> wrote in message
news:0f****************************@phx.gbl...
Thanks :)
That should do the trick.

Nov 20 '05 #9

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

Similar topics

19
by: Jim | last post by:
I have spent the past few weeks designing a database for my company. The problem is I have started running into what I believe are stack overflow problems. There are two tab controls on the form...
5
by: jbix | last post by:
We have a stack overflow happening. We are NOT doing any recusion. We do have an object being created in Global that is being handed the Context (which I assume is specific to the request thread). ...
4
by: Tom | last post by:
I have a VB.NET framework 1.1 application that I am installing on my user's workstation. It works fine on EVERY machine except for one - on this one machine it generates a 'Overflow or underflow in...
25
by: junky_fellow | last post by:
Is there any way by which the overflow during addition of two integers may be detected ? eg. suppose we have three unsigned integers, a ,b, c. we are doing a check like if ((a +b) > c) do...
8
by: starffly | last post by:
In my program, the caculated value is supposed to be no more than the constant named MAXINT,otherwise, overflow error will be informed.however, I cannot test if the value exceeds MAXINT within the...
1
by: starffly | last post by:
In my program, the calculated value is supposed to be no more than the constants named MAXINT,otherwise, the overflow error will be reported, however, I cannot test if the value exceeds MAXINT...
10
by: Parachute | last post by:
Using Borland Builder 6, I get numerical overflow when running a small programme without CodeGuard ("exp: OVERFLOW error"). The programme does not give any error messages when CodeGuard is...
3
by: Mike9900 | last post by:
Hello, I am getting SqlDateTime overflow if I use .NET remoting on Windows XP and Windows XP is the server where the SQL server is located at. If my computer is Windows 2003 where the sql...
8
by: Tophurious | last post by:
First, let me start by saying I know what an overflow is (Too large of a value into something that can't hold it, i.e. 35000 into an int, or 0/0, etc). Now to the issue. I have a class that I am...
42
by: thomas.mertes | last post by:
Is it possible to use some C or compiler extension to catch integer overflow? The situation is as follows: I use C as target language for compiled Seed7 programs. For integer computions the C...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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...
0
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,...
0
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.