Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: I think this is an impossible assignment...could you help? Date: Wed, 31 Aug 2011 11:44:52 -0700 Organization: None to speak of Lines: 33 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx04.eternal-september.org; posting-host="WEKlRqLUVZ7RHprEch2nAg"; logging-data="11378"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18LPfdUhJnOy9Cf9v1/dfGj" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:/m6yXIcB6igePTlIaK5iGiVvUIE= sha1:YS42sxMESc2C1XV9KJG59gf/mWM= Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:9775 "BartC" writes: > "Keith Thompson" wrote in message > news:lnmxeptv4b.fsf@nuthaus.mib.org... >> "BartC" writes: >>> "Jack" wrote in message >>> news:j3jj2t$eq3$1@speranza.aioe.org... >>> >>>> #include >>>> #define INVALID 0x80000000 >> [...] >>>> {long num, i; >> [...] >>>> { if (num == INVALID) >> >> If long is 32 bits, then 0x80000000 is outside the range of long. >> How about >> >> #define INVALID LONG_MIN >> ? > > I always think of 'long' as unsigned (because outside C, that's how I > use it), and I didn't see that. Similarly when I saw LONG_MIN I > immediately thought zero! > > But yes that would be a better signalling value. (You know about "unsigned long", right?) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"