use of memset and optimization

John Hascall john at iastate.edu
Fri Nov 8 10:26: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.

   However, it would be perfectly within its rights to do so,
   and perhaps some compiler now or in the future does/will.

John




More information about the krbdev mailing list