From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel 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 Organization: UCLA Computer Science Department Message-ID: <5045C2CB.90506@cs.ucla.edu> References: <83392zf7bu.fsf@gnu.org> <504506E8.5070506@cs.ucla.edu> <83r4qieszx.fsf@gnu.org> <25F1A420-CE2F-432B-BDE3-3E973E1B2CC3@swipnet.se> <50459584.8020209@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1346749152 26779 80.91.229.3 (4 Sep 2012 08:59:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 4 Sep 2012 08:59:12 +0000 (UTC) Cc: "emacs-devel@gnu.org" To: =?UTF-8?B?SmFuIERqw6Rydg==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 04 10:59:14 2012 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1T8oyV-0002Ub-Ve for ged-emacs-devel@m.gmane.org; Tue, 04 Sep 2012 10:59:12 +0200 Original-Received: from localhost ([::1]:39426 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8oyP-0003dm-MZ for ged-emacs-devel@m.gmane.org; Tue, 04 Sep 2012 04:59:05 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:33543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8oyI-0003da-VJ for emacs-devel@gnu.org; Tue, 04 Sep 2012 04:59:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8oyH-0004OG-TB for emacs-devel@gnu.org; Tue, 04 Sep 2012 04:58:58 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]:40587) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8oyH-0004O8-Ks for emacs-devel@gnu.org; Tue, 04 Sep 2012 04:58:57 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id B653039E8008; Tue, 4 Sep 2012 01:58:56 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zMgxLHrGXUd8; Tue, 4 Sep 2012 01:58:56 -0700 (PDT) Original-Received: from [192.168.1.3] (pool-108-23-119-2.lsanca.fios.verizon.net [108.23.119.2]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 3D99B39E8007; Tue, 4 Sep 2012 01:58:56 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120827 Thunderbird/15.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 131.179.128.62 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:152985 Archived-At: On 09/04/2012 01:31 AM, Jan Dj=C3=A4rv 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 =3D tp->tm_min; int hour =3D tp->tm_hour; int mday =3D tp->tm_mday; int mon =3D tp->tm_mon; int year_requested =3D tp->tm_year; int isdst =3D tp->tm_isdst; would be changed to something like this: const int min =3D tp->tm_min; const int hour =3D tp->tm_hour; const int mday =3D tp->tm_mday; const int mon =3D tp->tm_mon; const int year_requested =3D tp->tm_year; const int isdst =3D 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.