How is it with variables?
If I overflow a byte sized counter it will turn to 0 after passing 255, but is it OK to let a variable overflow? or should I take care of the overflow like this
Code:IF Counter > 254 Then Counter = 0 Endif
How is it with variables?
If I overflow a byte sized counter it will turn to 0 after passing 255, but is it OK to let a variable overflow? or should I take care of the overflow like this
Code:IF Counter > 254 Then Counter = 0 Endif
Last edited by Fredrick; - 24th August 2009 at 12:15.
For BYTE sized variables, when the value goes over 255 the upper bits are lost, which makes it automatically wrap around to 0.
You don't need to do it manually.
For words, it wraps when over 65535.
<br>
DT
Bookmarks