all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: "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: Tue, 04 Sep 2012 01:58:51 -0700	[thread overview]
Message-ID: <5045C2CB.90506@cs.ucla.edu> (raw)
In-Reply-To: <AC0897E3-0C75-403E-8407-EEBA0A8FC4AF@swipnet.se>

On 09/04/2012 01:31 AM, Jan Djärv wrote:

> Given that Emacs have quite a lot of functions that are more than a
> couple of hundred lines long, it is not typically easy.  For smaller
> functions, it can be, but small functions sometimes becomes big.

No doubt our styles differ, but I don't find it that hard.

For example, on my screen right now I have lib/mktime.c.  It has a
function __mktime_internal that is a couple of hundred lines long.  As
I understand it, you're proposing that almost all of its dozens of
local variables should be decorated with 'const'.  That is, something
like this:

  int min = tp->tm_min;
  int hour = tp->tm_hour;
  int mday = tp->tm_mday;
  int mon = tp->tm_mon;
  int year_requested = tp->tm_year;
  int isdst = tp->tm_isdst;

would be changed to something like this:

  const int min = tp->tm_min;
  const int hour = tp->tm_hour;
  const int mday = tp->tm_mday;
  const int mon = tp->tm_mon;
  const int year_requested = tp->tm_year;
  const int isdst = tp->tm_isdst;

I dunno.  To me those 'const's would take up valuable screen real
estate, and they would slow me down when I read the code, and it's
really not worth the trouble.  If I want to know whether mday is
modified later, I can just search for 'mday'; that's fast.  And in the
typical case where I'm not interested in that particular detail, the
'const's would be wasting my time.




  reply	other threads:[~2012-09-04  8:58 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
2012-09-04  8:31             ` Jan Djärv
2012-09-04  8:58               ` Paul Eggert [this message]
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

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

  git send-email \
    --in-reply-to=5045C2CB.90506@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    /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.