I think you are making a lot of confusion in a very important general concept to understand when using C, C ++, or other low-level languages. In a low-level language, there is an implicit assumption that the programmer knows what he is doing and makes no programming error .
This assumption allows language developers to simply ignore what should happen if the programmer breaks the rules. The end effect is that in C or C ++ there is no guarantee of "runtime" ... if you do something bad, it's just UNCERTAINTY ("undefined behavior" is a legal term), which should happen. Maybe it’s a crash (if you’re very lucky), or it may just be clearly nothing (unfortunately, in most cases ... it may crash in the right place when a million instructions are executed later).
For example, if you go beyond the array MAYBE , you will crash, maybe not, it may even be that the demon comes out of your nose (this is the “nose demon” you can find on the Internet). Just not what the compiler wrote, I thought.
Just never do this (if you need to write decent programs).
An additional burden for those who use low-level languages is that you should study all the rules well and not break them. If you break the rule, you cannot expect the "runtime error angel" to help you ... only the "undefined behavior daemons" are there.
source share