Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 May 2000 20:45:21 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        shimon@simon-shapiro.org, freebsd-current@FreeBSD.ORG
Subject:   Re: One more question (different now)
Message-ID:  <v04210103b53e58b35363@[128.113.24.47]>
In-Reply-To: <XFMail.000509190821.shimon@simon-shapiro.org>
References:  <XFMail.000509190821.shimon@simon-shapiro.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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           =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer          or  drosih@rpi.edu
Rensselaer Polytechnic Institute


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?v04210103b53e58b35363>