From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#35062: [PATCH v3 2/3] constify a bit of xterm.c Date: Sat, 13 Apr 2019 11:15:20 +0300 Message-ID: <8336mml3s7.fsf@gnu.org> References: <20190407021331.948-1-Hi-Angel@yandex.ru> <20190407021331.948-2-Hi-Angel@yandex.ru> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="80421"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35062@debbugs.gnu.org To: Konstantin Kharlamov , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 13 10:16:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hFDpb-000Klj-U3 for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Apr 2019 10:16:12 +0200 Original-Received: from localhost ([127.0.0.1]:48358 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFDpa-0003sB-PY for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Apr 2019 04:16:10 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFDpT-0003ru-S7 for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 04:16:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFDpT-0000F7-24 for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 04:16:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44248) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFDpS-0000Ee-RO for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 04:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hFDpS-0006A4-BN for bug-gnu-emacs@gnu.org; Sat, 13 Apr 2019 04:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Apr 2019 08:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35062 X-GNU-PR-Package: emacs Original-Received: via spool by 35062-submit@debbugs.gnu.org id=B35062.155514335323666 (code B ref 35062); Sat, 13 Apr 2019 08:16:02 +0000 Original-Received: (at 35062) by debbugs.gnu.org; 13 Apr 2019 08:15:53 +0000 Original-Received: from localhost ([127.0.0.1]:57792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFDpI-00069d-Lf for submit@debbugs.gnu.org; Sat, 13 Apr 2019 04:15:52 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:50503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFDpH-00069Q-0T for 35062@debbugs.gnu.org; Sat, 13 Apr 2019 04:15:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFDp0-0008F6-LT; Sat, 13 Apr 2019 04:15:37 -0400 Original-Received: from [176.228.60.248] (port=3718 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hFDoz-0007kV-RS; Sat, 13 Apr 2019 04:15:34 -0400 In-reply-to: <20190407021331.948-2-Hi-Angel@yandex.ru> (message from Konstantin Kharlamov on Sun, 7 Apr 2019 05:13:30 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:157575 Archived-At: > From: Konstantin Kharlamov > Date: Sun, 7 Apr 2019 05:13:30 +0300 > > * src/xterm.c (x_cr_draw_image, x_update_begin, > x_clear_under_internal_border, x_draw_fringe_bitmap, > x_set_glyph_string_clipping, x_draw_glyph_string_background, > x_draw_composite_glyph_string_foreground, x_send_scroll_bar_event): make > code easier to follow by making explicit that some variables are > immutable. (Bug#35062) > --- > v3: mention functions changed in commit messages, mention the bug > number, and don't mention that it fixes a warning since intention of > changes is clear either way. I'm really struggling with these changes. My main problem is that I don't see how using 'const' here improves the readability and clarity of the code. IMO, if the variable's name doesn't state its purpose, adding 'const' won't help much. And I think compilers nowadays are smart enough to deduce this by themselves. We had in the past similar issue with the 'register' qualifier; nowadays we remove those whenever we change code that uses them. Isn't it the same with 'const'? Paul, could you please comment on these proposed changes? Thanks.