"Daniel Gibson"  wrote in message news:lrdnri$2fge$1...@digitalmars.com...

One could write a memset_s oneself.. that does a memset, reads the data and writes a char of it or something to a global variable (hoping that the compiler won't optimize that to "just set that variable to 0").

Some compilers will do exactly that optimization.

The thing is: I don't want a compiler to remove code I wrote just because it "thinks" it's superfluous. It could tell me about it as a warning, but it shouldn't just silently do it. If removing code makes my code faster, I can do it myself.

No you don't, no you can't. You are using an optimizer because writing it in the perfectly precise, perfectly fast way makes your code unmaintainable. You want the optimizer to delete all those never-read initializations, drop all those temporary variables, and turn your multiplies into shifts and additions.

If you didn't, you wouldn't be using an optimizer.

Reply via email to