On Wed, Apr 25, 2012 at 1:50 AM, Vincent Lefevre <vinc...@vinc17.net> wrote: > On 2012-04-24 22:13:11 +1200, Michael Kerrisk (man-pages) wrote: >> Vincent, >> >> On Thu, Jan 6, 2011 at 5:38 AM, Vincent Lefevre <vinc...@vinc17.net> wrote: >> > The isgreater(3) man page says: >> > >> > The normal relation operations (like <, "less than") will fail if one >> > of the operands is NaN. This will cause an exception. To avoid this, >> > C99 defines these macros. The macros are guaranteed to evaluate their >> > operands only once. The operands can be of any real floating-point >> > type. >> > >> > It should probably be emphasised that the operands must not be of >> > integer types. >> >> The man page already says: "The operands can be of any real >> floating-point type." Is that not emphasis enough? > > This is a bit ambiguous, as "can" is not necessarily exclusive. > Macros often have a function-like interface: for instance, if a > real floating-point type is expected and the user provides an > integer, then the integer will automatically be converted to a > real floating-point type. This is not the case here. > > Also, the beginning of the paragraph is a bit like saying that > "isgreater" is a safe replacement for ">" to avoid a possible > exception. However, while with ">" the user doesn't need to take > care of the types, this is not the case for "isgreater". For > instance, in order to avoid a possible exception, one should > do the following replacements: > > With > > double x > int i; > > replace > > x > i > x > 0 > > by > > isgreater (x, (double) i) > isgreater (x, 0.0) > > Users may easily forget to do the change on the second argument.
So, how about the following replacement text: [[ The macros are guaranteed to evaluate their arguments only once. The arguments must be of real floating-point type (note: do not pass integer values as arguments to these macros, since the arguments will *not* be promoted to real-floating types). ]] ? Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface"; http://man7.org/tlpi/ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org