That's garbage. You get 8 as garbage, and subtract to get 7.
This is what undefined behavior is. Just because you keep getting 8 doesn't mean it's well-defined. Try doing more complex things in your code. Add variables above and below your char
.
About your "test", you say:
However, the consistency is hard to overlook, considering that garbage should be random.
You need to check your assumptions. "garbage should be random" says who? According to what should the garbage be random? The only way garbage will be random is if the system periodically goes through memory and assigns random numbers to it.
When we say "random", we mean we don't know what it will be. That doesn't make it non-deterministic. These are computers. If you tell them to do the same thing over and over, it will do the same thing over and over.
Your compiler and settings keep producing the same code that ends up giving you these garbage values. Deterministic, yet you cannot rely on this behavior: "random".
Also, 1-800 didn't mean for you to take this like you did. "8" does not necessarily denote garbage, as in the way things are set up your compiler fills them with 8. What he means is 8 is just as garbage as any other number.