Hacker News new | ask | show | jobs
by davtbaum 4018 days ago
> ...Except, of course, the the compiler can and will optimize away any such memset.

It's dependent on the function attributes of memset (e.g. __attribute__((pure))) - it won't always be optimized out.

https://www.cs.auckland.ac.nz/references/c/gcc4.7/Function-A...

1 comments

I am not talking about if it does currently optimize away a function call to an alternative to memset, I am talking about if it is allowed to optimize it away.

The compiler is allowed to optimize away that function call regardless of if it is memset or your own alternative.

Note that that is not the same thing as saying if it does currently optimize away that function call.