Why does gcc not have a warning option for &x+k where x is an identifier or result of . or -> operator and k!=0,1 (!=0 if dereferenced)?
C is a high level language and even admits memory-safe implementations, and there are really few if any others that admit explicit-storage implementations.
-
-
I don't think it can be proven that a memory-safe C compiler/runtime implementation is even possible, let alone practical to construct or usable. Certainly it's possible to do a good bit better than GCC does, but that's not saying a lot.
-
A trivial example: in C, as soon as your program adds two arbitrary signed integers (perhaps read from input files), your program is not memory-safe.
-
That has nothing to do with memory safety; it's just UB and an implementation can make it go away by defining the result.
-
The hard UBs to eliminate are data races, use after free, aliasing issues.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.