3 ms·
You don't need such a _compiler_ directive. The compiler can only optimize the call away because it can assume that std::memset does what the standard proscribe
by Someone 13y ago
You don't need such a _compiler_ directive. The compiler can only optimize the call away because it can assume that std::memset does what the standard proscribes.
Whenever you call an external function that is not in the standard library, the compiler can't know what it does and, hence, can't optimize it away.
The linker, on the other hand, might do across-library optimizations that lead to it removing the call. So, at worst, you need a linker directive.
Also, I am not sure you want this tagged to the function signature. There may be cases where optimizing the call away is perfectly valid.