From a2fd9a3cf2178a43fd37c696845637266821cc2c Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 27 Oct 2017 16:30:31 +0800 Subject: [PATCH] doc: add *-inl.h include rule to C++ style guide PR-URL: https://github.com/nodejs/node/pull/16548 Backport-PR-URL: https://github.com/nodejs/node/pull/16609 Reviewed-By: Ben Noordhuis Reviewed-By: Gireesh Punathil Reviewed-By: Daniel Bevenius Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig --- CPP_STYLE_GUIDE.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 3e7319c1f8e8f7..3bea5bb107586f 100644 --- a/CPP_STYLE_GUIDE.md +++ b/CPP_STYLE_GUIDE.md @@ -127,6 +127,21 @@ class FancyContainer { What it says in the title. +## Do not include `*.h` if `*-inl.h` has already been included + +Do + +```cpp +#include "util-inl.h" // already includes util.h +``` + +instead of + +```cpp +#include "util.h" +#include "util-inl.h" +``` + ## Avoid throwing JavaScript errors in nested C++ methods If you need to throw JavaScript errors from a C++ binding method, try to do it