Path: csiph.com!weretis.net!feeder8.news.weretis.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.c Subject: Re: bart again (UCX64) Date: Wed, 13 Sep 2023 03:01:33 +0100 Organization: A noiseless patient Spider Lines: 29 Message-ID: <87o7i6ompu.fsf@bsb.me.uk> References: <1262755563@f172.n1.z21.fsxnet> <20230907235623.619@kylheku.com> <4945f15a-22dd-431e-a732-81ed36615f27n@googlegroups.com> <543b9acc-de99-425c-bb1d-485e9f98889dn@googlegroups.com> <7cf7b6bd-39d9-4e22-baee-e128cfb2f214n@googlegroups.com> <8238a0d7-aeb2-4b26-8b1d-611caa37049an@googlegroups.com> <8734zkspd5.fsf@bsb.me.uk> <87ledcqrp0.fsf@bsb.me.uk> <87ledcp05z.fsf@bsb.me.uk> <678354ed-d89c-4d45-adfd-1ded3d22eecan@googlegroups.com> <87ttrzo1zm.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: dont-email.me; posting-host="d402efe92178590df0c731029dbf3024"; logging-data="2047718"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+D4u33diF/MA4apHTHpQDyWe+TkD1JzyE=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cancel-Lock: sha1:evXd0MKfVxUCaYiYKbfJllvev64= sha1:4MBW1wFCP+lAidag3zkDBj7jGy4= X-BSB-Auth: 1.922bf20345196a395405.20230913030133BST.87o7i6ompu.fsf@bsb.me.uk Xref: csiph.com comp.lang.c:175317 David Brown writes: > On 12/09/2023 18:28, Bart wrote: >> On 12/09/2023 16:17, Ben Bacarisse wrote: >>> Malcolm McLean writes: >>> >> >>>> No we can't use Haskell. >>> >>> That's a shame.  The Glasgow Haskell compiler reports that in >>> >>>    sign :: Double -> Int >>>    sign x | x <  0 = -1 >>>           | x == 0 =  0 >>>           | x >  0 =  1 >>> >>> the guards are non-exhaustive. > > To be fair, it will also give the same warning if you replace "Double" with > "Int". Well that's disappointing. I thought it was doing a more interesting analysis that would exclude such false positives. I must never have written a set of guards that was not obviously exhaustive. You do of course get a run-time error if you call sign with a NaN. -- Ben.