Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: code for 32/64 bit strtoul strtol strtoull strtoll Date: Mon, 30 Mar 2015 08:24:11 -0700 Organization: None to speak of Lines: 37 Message-ID: <877ftyld9g.fsf@kst-u.example.com> References: <87wq1z5md4.fsf@bsb.me.uk> <87fv8nkxny.fsf@kst-u.example.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="c77ff4d35e33d1c939d3461ebde8dd0d"; logging-data="30718"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3smd+2Afj3IEtQlfmQwyW" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:SVV2DadV2nKY5CCBsqfKbmn0Ih4= sha1:BTclg8+P01Tmph1ns5hO51FjT28= Xref: csiph.com comp.lang.c:59285 Barry Schwarz writes: > On Sun, 29 Mar 2015 19:48:49 -0700, Keith Thompson > wrote: >>Ben Bacarisse writes: >>> jacob navia writes: >>> >>>> Here is the code for the above functions. >>> >>> I don't think this conforms in these cases: >>> >>> "0x" >>> "0x0" >>> "0u" >>> >>> The first two are, I think, bugs, but the last is deliberate. Why do >>> you accept a suffix on the number? >>> >>> >> >>Because a suffix is permitted when base==0. N1570 7.22.1.3p3. > > 7.22.1.3 is strtod and friends. > > 7.22.1.4p3 (my copy dated 12Apr2011) states (emphasis mine)": > > "If the value of base is zero, the expected form of the subject > sequence is that of an integer constant as described in 6.4.4.1, > optionally preceded by a plus or minus sign, but ****not**** including > an integer suffix." Right on both counts; my mistake(s). That was extraordinarily sloppy of me. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"