Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Sep 1997 20:24:02 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, phk@critter.freebsd.dk
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:  <199709191024.UAA12065@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>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.

Bruce



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