all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andy Moreton <andrewjmoreton@gmail.com>
To: 23640@debbugs.gnu.org
Subject: bug#23640: 25.1.50; Getting rid of compiler warnings
Date: Tue, 31 May 2016 09:03:00 +0100	[thread overview]
Message-ID: <86bn3mbqob.fsf@gmail.com> (raw)
In-Reply-To: <ff882ff4-e092-afe2-3a71-e22bce3c114d@cornell.edu>

On Mon 30 May 2016, Paul Eggert wrote:

> Ken Brown wrote:
>> Why not just unconditionally initialize the variables that gcc complains about?
>
> That could make the code harder to understand. Someone who sees "int i = 0;"
> can reasonably infer that the 0 is needed, i.e., that a later part of the code
> needs the 0. Someone who sees "int i IF_LINT (= 0);" should be under no such
> illusion.

Surely this makes the code easier to understand, since "int i = 0;"
immediately shows that the variable is always initialised, so there is
no need to check that it is initialised before use on all code paths
(and recheck after making any chages during maintenance).

Given that the performance cost of this is likely to be unmeasurably
small, the IF_LINT stuff is either unneccessary clutter, or hiding a
latent bug.

> The FreeBSD and Cygwin uses of 'lint' violate the C Standard. For example:
>
> #define lint 1
> #include <stdio.h>
> _Noreturn int x;
>
> This program violates a constraint so the C Standard requires a compile-time
> diagnostic, but from what you say on FreeBSD and Cygwin the compiler
> misbehaves and silently ignores the _Noreturn. I see that HBBroeker is
> independently making a similar point on the Cygwin mailing list
> <https://www.cygwin.com/ml/cygwin/2016-05/msg00405.html>.

That may be so, but any codebase has to deal with the world as it is,
not the ideal in one of the applicable standards.

    AndyM






  parent reply	other threads:[~2016-05-31  8:03 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-28 18:40 bug#23640: 25.1.50; Getting rid of compiler warnings Ken Brown
2016-05-28 18:57 ` Eli Zaretskii
2016-05-28 21:47   ` Ken Brown
2016-05-29 22:43     ` Ken Brown
2016-05-30 11:39       ` Ken Brown
2016-05-30 14:41         ` Ken Brown
2016-05-30 16:20           ` Ken Brown
2016-05-30 23:29           ` Paul Eggert
2016-05-31  0:11             ` Ken Brown
2016-05-31  8:03             ` Andy Moreton [this message]
2016-05-31 22:22               ` Richard Stallman
2016-05-31  0:15           ` Paul Eggert
2016-06-01  8:35 ` Paul Eggert
2016-06-01 20:37   ` Richard Stallman
2016-06-01 21:10     ` Paul Eggert
2016-06-02 12:05       ` Andy Moreton
2016-06-03  3:35       ` Richard Stallman
2016-06-06 14:45         ` Paul Eggert
2016-06-07  6:19           ` Richard Stallman
2016-06-07  7:15             ` Paul Eggert
2016-06-08  4:00               ` Richard Stallman
2016-06-08  7:18                 ` Paul Eggert
2016-06-08 17:06                   ` Richard Stallman
2016-06-01  8:55 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86bn3mbqob.fsf@gmail.com \
    --to=andrewjmoreton@gmail.com \
    --cc=23640@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.