{"id":557,"url":"https://patchwork.libcamera.org/api/1.1/patches/557/?format=json","web_url":"https://patchwork.libcamera.org/patch/557/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20190212222021.28517-5-jacopo@jmondi.org>","date":"2019-02-12T22:20:21","name":"[libcamera-devel,4/4] Documentation: coding-style: Discourage move on shared_ptr<>","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"7e2d83f0622168cc913ffbe76a464d55b8f2cbd4","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/1.1/people/3/?format=json","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/557/mbox/","series":[{"id":175,"url":"https://patchwork.libcamera.org/api/1.1/series/175/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=175","date":"2019-02-12T22:20:17","name":"libcamera: mixed updated","version":1,"mbox":"https://patchwork.libcamera.org/series/175/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/557/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/557/checks/","tags":{},"headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay11.mail.gandi.net (relay11.mail.gandi.net\n\t[217.70.178.231])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 91515610BB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 12 Feb 2019 23:20:11 +0100 (CET)","from uno.lan (2-224-242-101.ip172.fastwebnet.it [2.224.242.101])\n\t(Authenticated sender: jacopo@jmondi.org)\n\tby relay11.mail.gandi.net (Postfix) with ESMTPSA id 85C35100002;\n\tTue, 12 Feb 2019 22:20:10 +0000 (UTC)"],"From":"Jacopo Mondi <jacopo@jmondi.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 12 Feb 2019 23:20:21 +0100","Message-Id":"<20190212222021.28517-5-jacopo@jmondi.org>","X-Mailer":"git-send-email 2.20.1","In-Reply-To":"<20190212222021.28517-1-jacopo@jmondi.org>","References":"<20190212222021.28517-1-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 4/4] Documentation: coding-style:\n\tDiscourage move on shared_ptr<>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 12 Feb 2019 22:20:11 -0000"},"content":"Using std::move() on return statement of a method or on the its returned\nvalue prevents the compiler from implementing copy-elision. Discourage\nthat in the coding style document.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Jacopo Mondi <jacopo@jmondi.org>\n---\n Documentation/coding-style.rst | 4 ++++\n 1 file changed, 4 insertions(+)","diff":"diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst\nindex 51afef27e9c1..065fbe0ab07b 100644\n--- a/Documentation/coding-style.rst\n+++ b/Documentation/coding-style.rst\n@@ -151,6 +151,10 @@ reference for the duration of the operation that borrows it.\n      never by reference. The caller can decide whether to transfer its ownership\n      of the std::shared_ptr<> with std::move() or retain it. The callee shall\n      use std::move() if it needs to store the shared pointer.\n+   * Do not over-use std::move(), as it may prevent copy-elision. In particular\n+     a function returning a std::shared_ptr<> value shall not use std::move() in\n+     its return statements, and its callers shall not wrap the function call\n+     with std::move().\n    * Borrowed references to shared objects are passed as references to the\n      objects themselves, not to the std::shared_ptr<>, with the same rules as\n      for single owner objects.\n","prefixes":["libcamera-devel","4/4"]}