[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: failure to build due to ignoring fwrite() result
From: |
Bruno Haible |
Subject: |
Re: failure to build due to ignoring fwrite() result |
Date: |
Tue, 31 Aug 2010 00:45:43 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Paul,
> In controversial areas like this, we should look to the GNU coding standards
> for advice, and they state that one shouldn't cast to void, or use
> similar measures merely to satisfy a lint checker.
Let me quote the GCS explicitly:
"Don't make the program ugly to placate `lint'. Please don't insert
any casts to `void'. Zero without a cast is perfectly fine as a null
pointer constant, except when calling a varargs function."
Observe that:
1) The main intent of this paragraph is not "don't insert any casts to
'void'". It is "Don't make the program ugly to placate 'lint'."
The reason is that 'lint' was a rarely used tool, and not a GNU tool.
But here we are dealing with warnings from GCC, which is our _main_
compiler, for _everyday_ use, and a GNU tool also.
2) The second part of this paragraph
"Zero without a cast is perfectly fine as a null
pointer constant, except when calling a varargs function."
is not only clearly oldish - since it is common practice nowadays
to write NULL for the null pointer constant - but also factually
wrong: 0 is also different from NULL as an argument of the
'sizeof' operator.
In summary, I think you are going too far by applying this oldish paragraph
to the current situation. And it would be better to update the GCS so that
they give reasonable advice also for today's situations, otherwise they
become less and less relevant.
Bruno
- Re: failure to build due to ignoring fwrite() result, (continued)
- Re: failure to build due to ignoring fwrite() result, Jim Meyering, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Bruce Korb, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Eric Blake, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Eric Blake, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Jim Meyering, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Eric Blake, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Paul Eggert, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Eric Blake, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Jim Meyering, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Bruce Korb, 2010/08/30
- Re: failure to build due to ignoring fwrite() result,
Bruno Haible <=
- Re: failure to build due to ignoring fwrite() result, Karl Berry, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Paul Eggert, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Bruno Haible, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Bruce Korb, 2010/08/30
- Re: failure to build due to ignoring fwrite() result, Paolo Bonzini, 2010/08/31
- Re: failure to build due to ignoring fwrite() result, Paolo Bonzini, 2010/08/31
- Re: failure to build due to ignoring fwrite() result, Bruno Haible, 2010/08/31
Re: failure to build due to ignoring fwrite() result, Rebecca Menessec, 2010/08/30