Which is the only possible logical consequence of modifying something that others asked you not.
const_cast is there for buggy (or legacy) libraries where const was not specified explicitly, but is implicit in the behavior.
const_cast is there for buggy (or legacy) libraries where const was not specified explicitly, but is implicit in the behavior.
const char *hello = "Hello World !", *world = "World";
char *tmpStr = strstr(hello, world); // IMPLICITE cast from const to non const
if(tmpStr) {
*tmpStr = 0; // Oupss
}
C is hard.not sure if fuzz testing can help here.
I wonder how many implicit-const-to-non-cost API are in ANSI C and Posix C