Article View: comp.std.c
Article #2169Re: should abs() be 'uint'?
From: Henry Spencer
Date: Wed, 30 Sep 1992 19:35
Date: Wed, 30 Sep 1992 19:35
13 lines
1160 bytes
1160 bytes
In article <1992Sep30.040719.2852@waggen.twuug.com> alpha@waggen.twuug.com (Joe Wright) writes: >Aren't we missing the point here? The whole point of abs() is >to take a signed value and return a positive result... >If the tested value can actually range to -32768 (16 bits) we are >using the wrong type. Use the next larger type (long?) instead. Either making the returned value unsigned or using a larger signed type would make sense *if we were starting from scratch*. It is not feasible to change the type of the existing abs() function, however; the mistake was made long ago and it is too late to fix it. -- There is nothing wrong with making | Henry Spencer @ U of Toronto Zoology mistakes, but... make *new* ones. -D.Sim| henry@zoo.toronto.edu utzoo!henry
Technical Details
Message-ID:
<BvEp3G.540@zoo.toronto.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!utcsri!utzoo!henryReferences:
<BvAzvK.EFx@zoo.toronto.edu> <1992Sep30.040719.2852@waggen.twuug.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!utcsri!utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Newsgroups: comp.std.c Subject: Re: should abs() be 'uint'? Message-ID: <BvEp3G.540@zoo.toronto.edu> Date: 30 Sep 92 19:35:37 GMT References: <BvAzvK.EFx@zoo.toronto.edu> <1992Sep30.040719.2852@waggen.twuug.com> Organization: U of Toronto Zoology Lines: 13