How does the compiler know that memset has no side effects without cross-function optimization. I agree that this could be an issue for some compilers, I'm just surprised that gcc is smart enough to optimize this.