I had accidentally made the following error. ABC is a byte and in the program one step is ABC=500.
What will happen? Can this give a wrong result in an other variable?
Kind regards
Jan Lichtenbelt
Byte overflow
Moderator: Benj
- Jan Lichtenbelt
- Posts: 797
- Joined: Tue Feb 17, 2009 8:35 pm
- Location: Haren GN, the Netherlands
- Has thanked: 128 times
- Been thanked: 264 times
- Contact:
- JonnyW
- Posts: 1230
- Joined: Fri Oct 29, 2010 9:13 am
- Location: Matrix Multimedia Ltd
- Has thanked: 63 times
- Been thanked: 290 times
- Contact:
Re: Byte overflow
Hi Jan.
Arrays can overflow and cause corruption, but writing too large a value to a variable will not, and wrap like this on a byte can even be a way of helping optimise code.
Here 500 = 0x1F4 so when this is clipped to a byte it should equal 0xF4, or 244.
Jonny
Arrays can overflow and cause corruption, but writing too large a value to a variable will not, and wrap like this on a byte can even be a way of helping optimise code.
Here 500 = 0x1F4 so when this is clipped to a byte it should equal 0xF4, or 244.
Jonny