The attached patch constifies a function parameter. My question is
whether this patch causes more pain to other developers than it does
good to the code.

The patch modifies a header that is included in many of our .cpp files,
so will cause a significant amount of recompilation.

I think I will come across this scenario in the future so I am curious:
what are your preferences?

(1) Do not commit any part of the patch because it is so minor.
(2) Commit the .cpp part, but not the .h part (this symmetry is not
checked by C++ since the constness only matters within the body of the
function).
(3) Commit the full patch, as is.
(4) Commit the full patch, as is. But save up these commits and push
only when I have a few of them or right after a commit that will cause
recompilation anyway.

Scott
From 737d444e8e43bff92d34ca4b2097aa64de9aadf5 Mon Sep 17 00:00:00 2001
From: Scott Kostyshak <skost...@lyx.org>
Date: Tue, 26 Jul 2016 20:38:13 -0400
Subject: [PATCH] Const a function parameter

---
 src/BufferView.cpp | 2 +-
 src/BufferView.h   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index f02cb66..9001143 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -873,7 +873,7 @@ void BufferView::scrollToCursor()
 }
 
 
-bool BufferView::scrollToCursor(DocIterator const & dit, bool recenter)
+bool BufferView::scrollToCursor(DocIterator const & dit, bool const recenter)
 {
        // We are not properly started yet, delay until resizing is
        // done.
diff --git a/src/BufferView.h b/src/BufferView.h
index b368685..309fc3a 100644
--- a/src/BufferView.h
+++ b/src/BufferView.h
@@ -185,7 +185,7 @@ public:
        void scrollToCursor();
        /// Scroll to the cursor.
        /// \param recenter Whether the cursor should be centered on screen
-       bool scrollToCursor(DocIterator const & dit, bool recenter);
+       bool scrollToCursor(DocIterator const & dit, bool const recenter);
        /// scroll down document by the given number of pixels.
        int scrollDown(int pixels);
        /// scroll up document by the given number of pixels.
-- 
2.7.4

Attachment: signature.asc
Description: PGP signature

Reply via email to