+ 1
What happens if a variable is influenced in an invalid way in C++?
If you add 9 billion to an int, what type of error will happen, can you have this trigger an event, like setting the int to 0?
2 odpowiedzi
+ 2
If this happens, can you have a .fail() type thing to check if it broke and do something, like set it to 0 or 32767?
+ 1
It will throw an error like Memory Type Exceeded or somthing like this. An int can store only 16bits, and can have values from 32767 to -32768 (don't know if the limit is larger now), so it just can't handle a so big value. It's for type float. There can be till 3.4+e38.