use of memset and optimization

Tom Yu tlyu at MIT.EDU
Fri Nov 8 16:09:00 EST 2002


>>>>> "Sam" == Sam Hartman <hartmans at MIT.EDU> writes:

Sam> Would it be sufficient to have either an implementation of memset
Sam> or a function that called memset taking a pointer to volatile
Sam> data as input?

You would probably have to implement a memset() surrogate that takes a
pointer to volatile as input.  Wrapping memset() with a function that
takes a pointer to volatile is undefined, since by calling memset()
you are discarding the qualifier from the pointed-to type.

Sam> The other option seems to be to declare all key material
Sam> volatile.  That might have negative performance consequences that
Sam> would be nice to avoid.

True, though note that implementing a memset() surrogate is difficult
to do portably if you want to preserve the "write word at a time"
property that some mem* implementations have.

---Tom



More information about the krbdev mailing list