diff lib/signal.in.h @ 13787:f4b0b520e409

prefer (X ? 1 : -1) when converting from boolean (1,0) to int (1,-1) Formerly the style was sometimes 2*X - 1, because the C standard was wrongly thought to disallow ?: in integral constant expressions. * lib/inet_ntop.c (verify_int_size): Rewrite 2*X-7 (!) to 4<=X?1:-1. * lib/signal.in.h (verify_NSIG_constraint): Rewrite 2*X-1 to X?1:-1. * lib/spawn.in.h (verify_POSIX_SPAWN_USEVFORK_no_overlap): Likewise. * lib/stdint.in.h (_verify_intmax_size): Likewise. * lib/time.in.h (struct __time_t_must_be_integral): Rewrite 2 * ((time_t) 1 / 2 == 0) - 1 to (time_t) 1; this suffices to verify that time_t cannot be floating.
author Paul Eggert <eggert@cs.ucla.edu>
date Sun, 10 Oct 2010 13:36:34 -0700
parents a19ace3ba849
children f2baaca789b2
line wrap: on
line diff
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -81,7 +81,7 @@
 #  endif
 
 /* This code supports only 32 signals.  */
-typedef int verify_NSIG_constraint[2 * (NSIG <= 32) - 1];
+typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
 
 # endif