🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2145

Re: should abs() be 'uint'?

#2145
From: Goeran Uddeborg
Date: Mon, 28 Sep 1992 16:24
14 lines
1187 bytes
In article <Bv7uL7.2IK@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
>In article <eyal.717552134@ise> eyal@echo.canberra.edu.au (Eyal Lebedinsky) writes:
>>If the function was 'unsigned int' then the result would ALWAYS fit into
>>the return type...
>
>It would make sense.  Unfortunately, that's not the way abs() was defined
>originally... and changing it now might break a lot of code.

It could hardly break a lot of code, could it?  The change would
increase the domain of the abs() function by one value.  Nothing that
worked previously would stop working.  (Unless somebody actually
depend on abs() returning a negative value for one particular input
value, but do they really want to protect that kind of code?  Is it
even defined that way in the standard?)
Technical Details
Message-ID: <1992Sep28.162422.26386@sics.se>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!sics.se!uddeborg
References: <eyal.717552134@ise> <Bv7uL7.2IK@zoo.toronto.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!sics.se!uddeborg
From: uddeborg@sisu.se (Goeran Uddeborg)
Subject: Re: should abs() be 'uint'?
Message-ID: <1992Sep28.162422.26386@sics.se>
Sender: news@sics.se
Organization: Swedish Institute of Systems Development
References: <eyal.717552134@ise> <Bv7uL7.2IK@zoo.toronto.edu>
Date: Mon, 28 Sep 1992 16:24:22 GMT
Lines: 14