unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: [Emacs-diffs] /srv/bzr/emacs/trunk r109864: Fix minor problems found by static checking.
Date: Mon, 03 Sep 2012 22:45:40 -0700	[thread overview]
Message-ID: <50459584.8020209@cs.ucla.edu> (raw)
In-Reply-To: <25F1A420-CE2F-432B-BDE3-3E973E1B2CC3@swipnet.se>

On 09/03/2012 10:29 PM, Jan Djärv wrote:
> Emacs does not use const much.

It's typically easy to determine whether a local variable
is never changed once initialized, simply by reading the code.
So, for local variables, 'const' is typically more trouble than
it's worth, as it adds a bit of noise to the code
without much compensating value.

For other things 'const' can be worthwhile sometimes,
as it can help the reader understand constraints on the code,
it can help avoid trivial programming errors,
and it can help the compiler generate better code.
Emacs tends to avoid 'const', though, partly
because it predates 'const, and partly I expect because
even in these other cases the readability advantage of
omitting 'const' arguably trumps the minor advantages
of using 'const'.



  reply	other threads:[~2012-09-04  5:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.503691.1346667442.854.emacs-diffs@gnu.org>
2012-09-03 15:35 ` [Emacs-diffs] /srv/bzr/emacs/trunk r109864: Fix minor problems found by static checking Eli Zaretskii
2012-09-03 18:54   ` Stefan Monnier
2012-09-03 19:37   ` Paul Eggert
2012-09-03 20:44     ` Eli Zaretskii
2012-09-03 22:29       ` Paul Eggert
2012-09-04  3:41       ` Stefan Monnier
2012-09-04  5:29         ` Jan Djärv
2012-09-04  5:45           ` Paul Eggert [this message]
2012-09-04  8:31             ` Jan Djärv
2012-09-04  8:58               ` Paul Eggert
2012-09-04 10:25                 ` Jan Djärv
2012-09-04 14:29             ` Jason Rumney
2012-09-04 19:19               ` Stefan Monnier
2012-09-04 18:51             ` Wojciech Meyer
2012-09-04 18:22         ` Wojciech Meyer
2012-09-04 14:26   ` Jason Rumney
2012-09-04 14:33     ` Andreas Schwab
2012-09-04 16:52       ` Eli Zaretskii
2012-09-04 18:36         ` Wojciech Meyer

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=50459584.8020209@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).