Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
add_of(3)		   Library Functions Manual		     add_of(3)

NAME
       add_of -	add two	integers, check	for arithmetic overflow

SYNTAX
       #include	<rangecheck.h>

       int add_of(dest,a,b);

DESCRIPTION
       If calculating a+b is possible without causing undefined	behavior or an
       arithmetic overflow in C, and the sum fits into the destination integer
       type, do	dest=a+b and return 0.

       Otherwise, return 1.

       Note: This is a macro, so dest does not have to be a pointer.

BUGS
       In  the	multiplication	functions, a return value of 1 signals success
       and 0 failure. In add_of, sub_of	and assign it's	the other way around.

SEE ALSO
       sub_of(3), assign(3), imult16(3), umult16(3),  imult32(3),  umult32(3),
       imult64(3), umult64(3)

								     add_of(3)

NAME | SYNTAX | DESCRIPTION | BUGS | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=add_of&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help