Bruno Haible wrote: > Hi Jim, > >> @@ -49,5 +49,5 @@ main (void) >> x.ss_family = 42; >> i = 42; >> >> - return 0; >> + return ! (i + x.ss_family); >> } > > This makes is hard to understand that the return value is really 0. (It costs > extra brain cycles to see this.) Wouldn't it be possible to write this? > > (void) x; > (void) i; > return 0; > > (I can't test it, as I don't have a gcc 4.6 snapshot installed.)
Thanks. That is better and does the trick. I've pushed this: >From bfbd822767f532ab05e24bda5b67b992f3562321 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyer...@redhat.com> Date: Fri, 11 Jun 2010 22:09:27 +0200 Subject: [PATCH] test-sys_socket: mark variables as used more readably * tests/test-sys_socket.c (main): Mark otherwise unused variables as "used" explicitly via (void) statement casts. This is more readable than using them in an artificial return expression. Suggestion from Bruno Haible. --- ChangeLog | 8 ++++++++ tests/test-sys_socket.c | 6 +++++- 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index a64e05c..7b6394d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-11 Jim Meyering <meyer...@redhat.com> + + test-sys_socket: mark variables as used more readably + * tests/test-sys_socket.c (main): Mark otherwise unused variables + as "used" explicitly via (void) statement casts. This is more + readable than using them in an artificial return expression. + Suggestion from Bruno Haible. + 2010-06-11 Bruno Haible <br...@clisp.org> Avoid some more warnings from "gcc -Wwrite-strings". diff --git a/tests/test-sys_socket.c b/tests/test-sys_socket.c index 6ea6a73..1c3b560 100644 --- a/tests/test-sys_socket.c +++ b/tests/test-sys_socket.c @@ -49,5 +49,9 @@ main (void) x.ss_family = 42; i = 42; - return ! (i + x.ss_family); + /* Tell the compiler that these variables are used. */ + (void) x; + (void) i; + + return 0; } -- 1.7.1.501.g23b46