Date: Tue, 10 Jun 1997 09:35:05 +0930 (CST) From: Michael Smith <msmith@atrad.adelaide.edu.au> To: arnej@stud.math.ntnu.no (Arne Henrik Juul) Cc: msmith@atrad.adelaide.edu.au, hackers@FreeBSD.ORG Subject: Re: %i conversion in sscanf? Message-ID: <199706100005.JAA02021@genesis.atrad.adelaide.edu.au> In-Reply-To: <199706091755.DAA00208@genesis.atrad.adelaide.edu.au> from Arne Henrik Juul at "Jun 9, 97 07:55:09 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
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 [[
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706100005.JAA02021>