Asking for too much.
To me it is more or less defined - you either get a memory access violation OR you do not. If you do not get a memory access violation then your extra write probably trashed some other data in your program. Nothing else can happen. If your program writes beyond an array bound
1. Then unless your program is really tracking each memory write, the program is not going to know of that.
2. It is the CPU which MAY detect something amiss. CPU can detect something amiss only and only if the memory address beyond the array was not allocated by your program. If that array e.g. is on heap and ends at an address 0x100, then probably 0x101 is still memory that belongs to your program's heap and CPU will not find anything wrong with that.
So you get an exception in some cases where the memory being written to does not belong to your program and in another cases you do not get an exception. To me that is more or less defined. The compilers are NOT adding any behavior to it because it is simply not in control of the language. What I mean to say is that in this case, in my opinion, compiler vendors do not look at the standards, see the behavior is undefined, and then go ahead add some behavior of their own. They simply can't. So talking to C++ guys is not an option :mad:. Alternative is to have C++ introduce it's own sophisticated memory management aka C#, Java etc. OR e.g. trap each access to memory via pointers OR ban pointers.
Now talking to CPU vendors may help - e.g. some day the CPU start understanding 'arrays' and other program level data variables and start writing dead bytes beyond the variable limits to detect out of bound accesses - waste of memory. Array is just one example. e.g. you can run into the same situation e.g. when you write a 4 byte integer value (through pointers) to a variable that was declared short (2 bytes). will require too much tracking on the CPU part.
