diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2010-10-10 13:36:34 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2010-10-10 13:36:53 -0700 |
commit | fea1830d840868b6d5d66ee30bb56f322f109254 (patch) | |
tree | 783d1b8e1a73c20fa03c02acdb61115b7bec47da /ChangeLog | |
parent | e9e556f53c74014cb122e8c7fd0405f40f7c9acb (diff) | |
download | gnulib-fea1830d840868b6d5d66ee30bb56f322f109254.tar.gz |
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.
Diffstat (limited to 'ChangeLog')
-rw-r--r-- | ChangeLog | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -1,3 +1,17 @@ +2010-10-10 Paul Eggert <eggert@cs.ucla.edu> + + 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. + 2010-10-08 Eric Blake <eblake@redhat.com> time: enforce recent POSIX ruling that time_t is integral |