use of memset and optimization

Tom Yu tlyu at MIT.EDU
Fri Nov 8 10:15:01 EST 2002


>>>>> "jaltman" == Jeffrey Altman <jaltman at columbia.edu> writes:

jaltman> And ... Does optimization occur for?  I would assume not.
jaltman> void i(char *buf, int len)
jaltman> {
jaltman>     char * key;
   
jaltman>     key = (char *)malloc(64);
  
jaltman>     strncpy(key, "seekrit89012345", 64);
jaltman>     encrypt(buf, len, key);
jaltman>     memset(key, 0, 64);
jaltman>     free(key);
jaltman> }

Not only does gcc 3.0.3 not optimize out the memset() call, it also
doesn't inline any of the functions.

---Tom



More information about the krbdev mailing list