From owner-freebsd-bugs Fri Sep 19 04:20:24 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id EAA04591 for bugs-outgoing; Fri, 19 Sep 1997 04:20:24 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [195.8.129.26]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id EAA04563; Fri, 19 Sep 1997 04:20:12 -0700 (PDT) Received: from critter.freebsd.dk (localhost.cybercity.dk [127.0.0.1]) by critter.freebsd.dk (8.8.7/8.8.7) with ESMTP id NAA13343; Fri, 19 Sep 1997 13:19:29 +0200 (CEST) To: Bruce Evans 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 In-reply-to: Your message of "Fri, 19 Sep 1997 20:24:02 +1000." <199709191024.UAA12065@godzilla.zeta.org.au> Date: Fri, 19 Sep 1997 13:19:29 +0200 Message-ID: <13341.874667969@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-bugs@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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."