bug-standards
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: failure to build due to ignoring fwrite() result


From: Paul Eggert
Subject: Re: failure to build due to ignoring fwrite() result
Date: Mon, 30 Aug 2010 16:57:25 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Thunderbird/3.0.6

(adding <address@hidden> to the To: list)

Here is a proposed patch that follows up on the discussion about
"(void) fwrite (...)"  and "ignore_value (fwrite (...))" that is rooted at
<http://lists.gnu.org/archive/html/bug-gnulib/2010-08/msg00233.html>.
This doesn't capture all the comments there (as they don't all agree),
but it is an attempt to modernize the discussion a bit, to fix
a technical problem with NULL that Bruno Haible pointed out, and to
capture what I hope is a reasonable consensus for the intent of
this part of the standards

*** old/standards.texi  Tue Aug 24 10:42:55 2010
--- new/standards.texi  Mon Aug 30 16:50:16 2010
***************
*** 2750,2759 ****
    fatal ("virtual memory exhausted");
  @end example
  
  @pindex lint
! Don't make the program ugly to placate @code{lint}.  Please don't insert any
! casts to @code{void}.  Zero without a cast is perfectly fine as a null
! pointer constant, except when calling a varargs function.
  
  @node Names
  @section Naming Variables, Functions, and Files
--- 2750,2766 ----
    fatal ("virtual memory exhausted");
  @end example
  
+ @pindex gcc
  @pindex lint
! @pindex valgrind
! Don't make the program ugly to placate @code{gcc -Wall}, @code{lint},
! @code{valgrind}, or other software analysis tools.  These tools can
! help find bugs, but they can also generate false alarms for constructs
! that they incorrectly consider to be suspicious.  Although we want
! useful warnings and don't want useless ones, we also want code that is
! as readable as possible and is not cluttered with unnecessary casts or
! wrappers.  For example, in C, please don't insert casts to @code{void}
! or replace @code{0} with @code{NULL} merely to pacify a lint checker.
  
  @node Names
  @section Naming Variables, Functions, and Files




reply via email to

[Prev in Thread] Current Thread [Next in Thread]