Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!tikal!sigma!uw-nsr!john From: john@uw-nsr.UUCP (John Sambrook) Newsgroups: comp.lang.c Subject: Re: Constant overflow Message-ID: <1262@uw-nsr.UUCP> Date: 13 Mar 88 19:27:56 GMT References: <2747@mmintl.UUCP> Reply-To: john@uw-nsr.UUCP (John Sambrook 548-4386) Organization: UW-Bioengineering, Seattle, WA Lines: 35 In article <2747@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes: > >Try this one on your favorite C compiler. So far, every one I've tried >(including lint) has had no complaint: > > long i = 9876543210L; > >(The problem, of course, is that that number doesn't fit in 32 bits. If >your compiler has a word size of more than 32 bits, try something big >enough to overflow whatever it uses.) Ok, here is the output I get on our DG MV/10000 running DG/UX 3.11 and DG/UX C 3.90.14: Script started on Sun Mar 13 11:18:20 1988 % cat main.c main() { long i = 9876543210L; } % cc main.c -o main Error 104 severity 2 beginning on line 4 (Line 4 of file main.c) long i = 9876543210L; ^ The int constant "9876543210L" could not fit into 32 bits without a loss of precision. The compiler truncated it on the left. % ^D Script done at Sun Mar 13 11:19:06 1988 -- John Sambrook Internet: john@nsr.bioeng.washington.edu University of Washington RC-05 UUCP: uw-nsr!john Seattle, Washington 98195 Dial: (206) 548-4386