delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/02/23/11:31:11

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Eric Sosman <Eric DOT Sosman AT sun DOT com>
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: Fibonacci number
Date: Mon, 23 Feb 2004 11:01:15 -0500
Organization: Sun Microsystems
Lines: 16
Message-ID: <403A23CB.84B325E@sun.com>
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>
NNTP-Posting-Host: tardis.east.sun.com
Mime-Version: 1.0
X-Trace: news1brm.Central.Sun.COM 1077552075 16544 129.148.168.113 (23 Feb 2004 16:01:15 GMT)
X-Complaints-To: usenet AT news1brm DOT central DOT sun DOT com
NNTP-Posting-Date: Mon, 23 Feb 2004 16:01:15 +0000 (UTC)
X-Mailer: Mozilla 4.79C-CCK-MCD [en] (X11; U; SunOS 5.8 sun4u)
X-Accept-Language: en
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

CBFalconer wrote:
> [...]
> BTW the following shows up a glitch in DJGPP 2.03 system.  Calling
> the program with an argument of -1 returns the overflow condition,
> because strtoul returns ULONG_MAX rather than 0.  Cross-posted to
> comp.os.msdos.djgpp for this.
> [...]
>       n = strtoul(argv[1], NULL, 10);

    If you mean that strtoul("-1", NULL, 10) returns ULONG_MAX,
then there's no bug: that's what it is supposed to do.  See
the Standard, section 7.20.1.4 paragraph 3, and note the text
"optionally preceded by a plus or minus sign."

-- 
Eric DOT Sosman AT sun DOT com

- Raw text -


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