{"id":2211,"url":"https://patchwork.libcamera.org/api/1.1/patches/2211/?format=json","web_url":"https://patchwork.libcamera.org/patch/2211/","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":"<20191023135258.32256-1-laurent.pinchart@ideasonboard.com>","date":"2019-10-23T13:52:55","name":"[libcamera-devel,1/4] Documentation: coding-style: Document usage of C compatibility headers","commit_ref":"c98407bb2fdb58d2d0f66f96904661a628d4a3af","pull_url":null,"state":"accepted","archived":false,"hash":"ea269c414ba77dba0ea34c48b7dbef9e70516802","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/2211/mbox/","series":[{"id":543,"url":"https://patchwork.libcamera.org/api/1.1/series/543/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=543","date":"2019-10-23T13:52:55","name":"[libcamera-devel,1/4] Documentation: coding-style: Document usage of C compatibility headers","version":1,"mbox":"https://patchwork.libcamera.org/series/543/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/2211/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/2211/checks/","tags":{},"headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2A8066138B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 15:54:01 +0200 (CEST)","from pendragon.ideasonboard.com (143.121.2.93.rev.sfr.net\n\t[93.2.121.143])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id ABA6171F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 23 Oct 2019 15:54:00 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1571838840;\n\tbh=Dw2zSmuQ4ZAjdEVFMkfMIMApPUxbKHYW5Cr6RHVStv0=;\n\th=From:To:Subject:Date:From;\n\tb=fRgTkJ2GIep85xx044Vm3rKnQZgqjyzcB8j/lidVnmfj8He86vvdK6cK6z7LihSuS\n\tKdgvD+bwU6vq07WPUo+gKXK5t/W+YnOacx1COyESFUNRthDl5SrX3Vs6m1xKuacgTg\n\td6usKaHpW1l6yncSx4n88gwdXIdmHEwuop4vYFOs=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed, 23 Oct 2019 16:52:55 +0300","Message-Id":"<20191023135258.32256-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.23.0","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH 1/4] Documentation: coding-style: Document\n\tusage of C compatibility headers","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Wed, 23 Oct 2019 13:54:01 -0000"},"content":"The C++ standard defines a set of C++ standard library headers, and for\nsome of them, defines C compatibility headers. The former have a name of\nthe form <cxxx> while the later are named <xxx.h>. The C++ headers\ndeclare names in the std namespace, and may declare the same names in\nthe global namespace. The C compatibility headers declare names in the\nglobal namespace, and may declare the same names in the std namespace.\n\nWe want to standardise on one set of headers through libcamera, and\ndon't want to rely on optional behaviour. We can thus either use the C++\nheaders with an explicit std:: namespace qualifier through the code, or\nthe C headers without the qualifier.\n\nBoth set of headers are defined by the C++ standard, and are thus valid\nchoices. After weighting pros and cons, we have decided to use the C\ncompatibility headers, as nobody wanted to write std::uint32_t. Document\nthis decision.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n Documentation/coding-style.rst | 12 ++++++++++++\n 1 file changed, 12 insertions(+)","diff":"diff --git a/Documentation/coding-style.rst b/Documentation/coding-style.rst\nindex 8dd1afce1a2c..ced3155169a6 100644\n--- a/Documentation/coding-style.rst\n+++ b/Documentation/coding-style.rst\n@@ -170,6 +170,18 @@ These rules match the `object ownership rules from the Chromium C++ Style Guide`\n    long term borrowing isn't marked through language constructs, it shall be\n    documented explicitly in details in the API.\n \n+C Compatibility Headers\n+~~~~~~~~~~~~~~~~~~~~~~~\n+\n+The C++ standard defines a set of C++ standard library headers, and for some of\n+them, defines C compatibility headers. The former have a name of the form\n+<cxxx> while the later are named <xxx.h>. The C++ headers declare names in the\n+std namespace, and may declare the same names in the global namespace. The C\n+compatibility headers declare names in the global namespace, and may declare\n+the same names in the std namespace. Usage of the C compatibility headers is\n+strongly preferred. Code shall not rely on the optional declaration of names in\n+the global or std namespace.\n+\n \n Documentation\n -------------\n","prefixes":["libcamera-devel","1/4"]}