delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/02/24/09:30:36

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Message-ID: <403B5B4A.F47CA8D1@yahoo.com>
From: CBFalconer <cbfalconer AT yahoo DOT com>
Organization: Ched Research
X-Mailer: Mozilla 4.75 [en] (Win98; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Fibonacci number
References: <d7c3a0b2 DOT 0402220759 DOT 34d6435d AT posting DOT google DOT com> <4038E8CA DOT 6491815E AT virginia DOT edu> <4039DD96 DOT 3F36F3B7 AT yahoo DOT com> <200402231458 DOT i1NEwKwm020904 AT envy DOT delorie DOT com> <403A301C DOT E8F5FE65 AT yahoo DOT com> <200402231751 DOT i1NHp5lv022894 AT envy DOT delorie DOT com> <c1fijm$314$2 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
Lines: 37
Date: Tue, 24 Feb 2004 14:15:43 GMT
NNTP-Posting-Host: 12.76.140.75
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc04-news.ops.worldnet.att.net 1077632143 12.76.140.75 (Tue, 24 Feb 2004 14:15:43 GMT)
NNTP-Posting-Date: Tue, 24 Feb 2004 14:15:43 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hans-Bernhard Broeker wrote:
> 
> DJ Delorie <dj AT delorie DOT com> wrote:
> 
> > >   [#4] The subject sequence is defined as the longest  initial
> > >   subsequence  of  the  input  string, starting with the first
> > >   non-white-space character, that is  of  the  expected  form.
> 
> > ISO 9899/1999 explicitly allows '-' to be part of the expected form
> > for strtoul.
> 
> So does C89.  It explicitly mentions both signs and digits as allowed
> characters in the subject sequence.
> 
> > Ok, *that* is a bug.  Amusingly enough, glibc 2.3.2 has the same bug.
> 
> I don't it's a bug.  Not unless they changed this between C89 and C99.
> ISO C90 section 7.10.1.6 (strtoul), paragraph 5 says:
> 
>   If the subject sequence begins with a minus sign, the value resulting
>   from the conversion is negated.
> 
> Since negation is a well-defined operation on unsigned longs, there's
> no error involved.  In other words: strtoul on "-1" will result in
> ULONG_MAX not because an error was detected, but because ULONG_MAX is
> the correct result of

Which makes the whole matter moot, since the existing code meets
that standard.  It is not the first standard provision of which I
disapprove :-)

-- 
Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019