Date: Fri, 19 Sep 1997 13:19:29 +0200 From: Poul-Henning Kamp <phk@critter.freebsd.dk> To: Bruce Evans <bde@zeta.org.au> Cc: atrens@nortel.ca, freebsd-bugs@FreeBSD.ORG, gram@cdsec.com, grog@lemis.com, hackers@FreeBSD.ORG, peter@spinner.dialix.com.au Subject: Re: Bug in malloc/free Message-ID: <13341.874667969@critter.freebsd.dk> In-Reply-To: Your message of "Fri, 19 Sep 1997 20:24:02 %2B1000." <199709191024.UAA12065@godzilla.zeta.org.au>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <199709191024.UAA12065@godzilla.zeta.org.au>, Bruce Evans writes: >>>STDC only allows operations on auto variables and assignment to static >>>variables of type sig_atomic_t. We aren't STDC conformant either. > ^volatile >>>Operations on auto floating point variables may corrupt the floating >>>point state. This isn't a problem in practice, since nothing useful >>>can be done using only auto floating point variables. >> >>You could calculate pi... :-) > >I was going to say that this is more useless than usual since there is >no way to output the results. However, I think the following works: > > volatile sig_atomic_t encoded_results[MANY]; > > void handler(int s) { > int i; > > for (i = 0; i < MANY; ++i) > encoded_results[i] = bit_of_pi(i) == 0 ? 1 : 2; > } > >There is no way to calculate only a few bits per call since there is no >way to keep track of state. Wrong. A signal handler can have a private static variable. :-) -- Poul-Henning Kamp FreeBSD coreteam member phk@FreeBSD.ORG "Real hackers run -current on their laptop."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?13341.874667969>