Path: utzoo!attcan!uunet!dino!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!psuvax1!psuvm!dn5 From: DN5@psuvm.psu.edu Newsgroups: comp.sys.mac.programmer Subject: Re: THINK C bug Message-ID: <90039.091314DN5@PSUVM.BITNET> Date: 8 Feb 90 14:13:14 GMT References: <6661@ucdavis.ucdavis.edu> <19195@dartvax.Dartmouth.EDU> Organization: Penn State University Lines: 23 >In article <6661@ucdavis.ucdavis.edu> lim@iris.ucdavis.edu (Lloyd Lim) writes: >>I'm using THINK C 4.0 and it won't accept the constant -2147483648 but it >>does accept -2147483647 and 2147483647. This value does fit in a long. >>Curiously, it does accept 0x80000000 and -2147483647 - 1. >> >>Isn't this a bug or am I going to be called bunky? Actually, this has a simple explanation (its still a bug, but an understandable one :-) ). Most numerical input routines I've seen flag any initial symbols that they see (mostly "-"), and then convert the number. +2147483648 is too big to fit into a signed long. The error gets checked after the number is read in, and before the negative sign is used. It would be nice if the numerical input routine would special case this number (and it wouldn't be too difficult). Had the number not been too big, the negative sign would then be applied to the number. D. Jay Newman dn5@psuvm.psu.edu