🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2168

strtoul on negative numbers

#2168
From: Jerry Schwarz
Date: Wed, 30 Sep 1992 17:58
15 lines
819 bytes
What is the result of 
  
    strtoul("-2", (char**)0, 10)

The description is clear that the minus sign is allowed.
The relevant sentence describing the result is.
	
"If the correct value is outside the range of representable values
ULONG_MAX is returned ..."

My reading of this is that it requires ULONG_MAX to be returned,
but others think that -2 is a representable value (equal to
ULONG_MAX-1) and so ULONG_MAX-1 should be returned. 

  -- Jerry Schwarz
Technical Details
Message-ID: <1992Sep30.175835.7972@lucid.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!lucid.com!lucid.com!jss

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!lucid.com!lucid.com!jss
From: jss@lucid.com (Jerry Schwarz)
Subject: strtoul on negative numbers
Message-ID: <1992Sep30.175835.7972@lucid.com>
Sender: usenet@lucid.com
Reply-To: jss@lucid.com (Jerry Schwarz)
Organization: Lucid Inc.
Date: Wed, 30 Sep 92 17:58:35 GMT
Lines: 30