By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,238 Members | 1,485 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,238 IT Pros & Developers. It's quick & easy.

Overflow without error?

P: n/a

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
Share this Question
Share on Google+
8 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
Thanks :)
That should do the trick.
Nov 20 '05 #5

P: n/a
* "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

P: n/a
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

P: n/a
* "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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.