emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] /srv/bzr/emacs/trunk r109864: Fix minor problems found


From: Paul Eggert
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
User-agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0

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 via email to

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