At 7:08 PM -0400 5/9/00, Simon Shapiro wrote:
>Given:
>
>typedef struct junk {
>        ...
>} junk_t
>
>volatile junk_t trash;
>
>What I want to do is zero out trash.
>
>bzero(trash, sizeof(junk_t));
>
>produces a warning about loss of volatility.
>So, how do I make everyone happy?

Write a 'bzerov' function, which takes a volatile first
parameter.  Presumably you could just copy the source
for bzero and change the 1st parameter declaration...

or

write a dumb 'bzerov' macro, which casts the first
parameter to be pointer to volatile char, and then
loops over it setting to zero one byte at a time.


---
Garance Alistair Drosehn           =   [EMAIL PROTECTED]
Senior Systems Programmer          or  [EMAIL PROTECTED]
Rensselaer Polytechnic Institute


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to