Hi, all--

On Nov 27, 2013, at 10:10 AM, Paul Eggert <egg...@cs.ucla.edu> wrote:
> On 11/27/2013 09:05 AM, Joerg Schilling wrote:
>> If you however like to write portable code, you cannot expect 
>> something like ignore_value() to be available.
> 
> ignore_value is free software, is simple,
> and is quite portable in practice
> -- more portable than casting to 'void' is,
> anyway.  It's not really a contest.

With respect, folks who want to pull in gnulib for ignore_value() simply
in order to write portable ANSI-C code are far more likely to benefit from
Joerg's advice and experience in writing portable code-- code which does _not_
assume GCC & gnulib-- than they are likely to be correct about the relative
portability of code to non-GNU platforms which don't come with gnulib.

Failing that, if one doesn't care what K&R says and prefers non-standard
GNU extensions to re-implement what was already in ANSI-C, fine, but let's
not pretend that casting to void hasn't been documented for literally 25+ years.

The C Programming Language, 2nd Edition, Kernighan & Richie, 1988, page 213:

"A 6.7 Void
[ ... ]
An expression may be converted to type void by a cast.  For example, a void cast
documents the discarding of a function call used as an expression statement."

Regards,
-- 
-Chuck


Reply via email to