On 11/27/2013 01:18 PM, Charles Swiger wrote: > Thanks for the reply, and for Paul's as well, but that really is orthogonal > to the original point: using ignore_value() rather than a cast to void is a > GNUism which some folks seem to prefer in lieu of portable ANSI-C code.
Huh? ignore_value(expression) is just as portable to ANSI C compilers as (void)expression as long as you have the #define ignore_value(expression) properly declared up front. Furthermore, it has the benefit of being declarative functional syntax rather than a cast, making it obvious that we know why we are using the call (I tend to avoid bare casts in my code because they have the tendency to hide too much information). > > That's readily apparent just from looking at: > > http://github.com/gagern/gnulib/blob/master/lib/ignore-value.h > > # if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) > > ...which is testing for GCC 3.4 or later. It does one thing for newer gcc to shut up gcc, and another thing for other compilers (including older gcc), and the alternative for non-gcc is ((void)(expression)). In other words, the macro devolves to ANSI standard code in all cases except for where we know extension syntax that is guaranteed to shut up compilers that happen to have a particular extension of warning on (void)expression. There's nothing wrong with using extensions in portable code when you've first checked that the extension is available; and the resulting #if/#else/#endif guarantees a fully-portable ignore_value. > > However, since we're on the topic and you appear to be one of the authors > of this code, Eric, would you agree with Paul that either ignore-value.h is > de minimus and not protectable under copyright, Reluctantly, yes. It really is quite small, and took me less than half an hour of reading the GCC manual to come up with the one-liner GCC branch of the #if condition; and the #else condition is the well-known ((void)(expression)). > or would you be willing to > also place it under a permissive license like the 2-clause BSD or MIT/zlib > licenses rather than under GPLv3? You aren't forced to use GPLv3+. The gnulib ignore-value module is already under LGPLv2+ (per the gnulib documentation, we list GPLv3 in the gnulib.git repo for .c and .h files for convenience in symlinking directly into gnulib for a GPLv3 project; but if you use './gnulib-tool --lgpl=2' to copy the code into your project, that action will rewrite the license to the minimum license agreed on by the authors or fail if the looser license is not acceptable). But if it can be argued that the code is copyrightable, then I refuse to relicense my contribution any further than its current LGPLv2+ status (BSD is too weak for my personal preference of FREE software - I generally refuse to release my code in such a manner that it can be abused in a proprietary nature without giving the same freedoms to others as I used in writing my code). -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature