> ...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...