From owner-freebsd-hackers Mon Jun 9 17:51:21 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id RAA25606 for hackers-outgoing; Mon, 9 Jun 1997 17:51:21 -0700 (PDT) Received: from genesis.atrad.adelaide.edu.au (genesis.atrad.adelaide.edu.au [129.127.96.120]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id RAA25580 for ; Mon, 9 Jun 1997 17:51:16 -0700 (PDT) Received: (from msmith@localhost) by genesis.atrad.adelaide.edu.au (8.8.5/8.7.3) id JAA02021; Tue, 10 Jun 1997 09:35:05 +0930 (CST) From: Michael Smith Message-Id: <199706100005.JAA02021@genesis.atrad.adelaide.edu.au> Subject: Re: %i conversion in sscanf? In-Reply-To: <199706091755.DAA00208@genesis.atrad.adelaide.edu.au> from Arne Henrik Juul at "Jun 9, 97 07:55:09 pm" To: arnej@stud.math.ntnu.no (Arne Henrik Juul) Date: Tue, 10 Jun 1997 09:35:05 +0930 (CST) Cc: msmith@atrad.adelaide.edu.au, hackers@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Arne Henrik Juul stands accused of saying: > > ANSI C mandates that scanf %i should work like strtol() with base=0; > which again should work the same way that integer constants in the > code does (but with an optional preceding plus or minus sign). > > Then it goes on (for strtol) to say: "If the correct value is outside > the range of representable values, LONG_MAX or LONG_MIN is returned > (according to the sign of the value), and the value of the macro > ERANGE is stored in errno." > > I take a wild guess your application really wanted to use strtoul(), > which isn't available everywhere (though it's in ANSI C so it should > be common). The application is quirky enough that I think you're right. What I am wondering is, given that the application purports to run correctly under other compilers, whether those compilers are wrong or whether there is some other interpretation available. At any rate, thanks. I shall pound said application accordingly. > - Arne H. J. -- ]] Mike Smith, Software Engineer msmith@gsoft.com.au [[ ]] Genesis Software genesis@gsoft.com.au [[ ]] High-speed data acquisition and (GSM mobile) 0411-222-496 [[ ]] realtime instrument control. (ph) +61-8-8267-3493 [[ ]] Unix hardware collector. "Where are your PEZ?" The Tick [[