Browse Source

Replace the vague, incorrect, and confusing BUGS sections with CAVEATS

clearly stating which arguments have to be avoided, and mention the
header files defining the constants required for the checks.
Feedback and OK guenther@, OK bluhm@.
OPENBSD_6_5
schwarze 5 years ago
parent
commit
f3824ccfdc
3 changed files with 33 additions and 12 deletions
  1. +9
    -4
      src/lib/libc/stdlib/abs.3
  2. +9
    -4
      src/lib/libc/stdlib/imaxabs.3
  3. +15
    -4
      src/lib/libc/stdlib/labs.3

+ 9
- 4
src/lib/libc/stdlib/abs.3 View File

@ -29,15 +29,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $OpenBSD: abs.3,v 1.11 2013/07/17 05:42:11 schwarze Exp $
.\" $OpenBSD: abs.3,v 1.12 2019/01/18 07:32:17 schwarze Exp $
.\"
.Dd $Mdocdate: July 17 2013 $
.Dd $Mdocdate: January 18 2019 $
.Dt ABS 3
.Os
.Sh NAME
.Nm abs
.Nd integer absolute value function
.Sh SYNOPSIS
.In limits.h
.In stdlib.h
.Ft int
.Fn abs "int j"
@ -66,5 +67,9 @@ The
.Fn abs
function first appeared in
.At v6 .
.Sh BUGS
The absolute value of the most negative integer remains negative.
.Sh CAVEATS
The result of applying
.Fn abs
to
.Dv INT_MIN
is undefined.

+ 9
- 4
src/lib/libc/stdlib/imaxabs.3 View File

@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $OpenBSD: imaxabs.3,v 1.7 2014/11/30 21:21:59 schwarze Exp $
.\" $OpenBSD: imaxabs.3,v 1.8 2019/01/18 07:32:17 schwarze Exp $
.\"
.Dd $Mdocdate: November 30 2014 $
.Dd $Mdocdate: January 18 2019 $
.Dt IMAXABS 3
.Os
.Sh NAME
@ -39,6 +39,7 @@
.Nd integer absolute value function
.Sh SYNOPSIS
.In inttypes.h
.In stdint.h
.Ft intmax_t
.Fn imaxabs "intmax_t j"
.Sh DESCRIPTION
@ -61,5 +62,9 @@ The
.Fn imaxabs
function conforms to
.St -isoC-99 .
.Sh BUGS
The absolute value of the most negative integer remains negative.
.Sh CAVEATS
The result of applying
.Fn imaxabs
to
.Dv INTMAX_MIN
is undefined.

+ 15
- 4
src/lib/libc/stdlib/labs.3 View File

@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $OpenBSD: labs.3,v 1.16 2017/08/01 14:57:02 schwarze Exp $
.\" $OpenBSD: labs.3,v 1.17 2019/01/18 07:32:17 schwarze Exp $
.\"
.Dd $Mdocdate: August 1 2017 $
.Dd $Mdocdate: January 18 2019 $
.Dt LABS 3
.Os
.Sh NAME
@ -40,6 +40,7 @@
.Nm qabs
.Nd return the absolute value of a long integer
.Sh SYNOPSIS
.In limits.h
.In stdlib.h
.Ft long
.Fn labs "long i"
@ -73,5 +74,15 @@ and
.Fn llabs
functions conform to
.St -isoC-99 .
.Sh BUGS
The absolute value of the most negative integer remains negative.
.Sh CAVEATS
The results of applying
.Fn labs
to
.Dv LONG_MIN
and
.Fn llabs
to
.Dv LLONG_MIN
are undefined, and
.Fn qabs
is not portable in the first place.

Loading…
Cancel
Save