From ab2c35100fb2b67ecea597dbc29134b5c7f1d684 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Fri, 27 Oct 2017 16:30:31 +0800 Subject: doc: add *-inl.h include rule to C++ style guide PR-URL: https://github.com/nodejs/node/pull/16548 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(+) (limited to 'CPP_STYLE_GUIDE.md') diff --git a/CPP_STYLE_GUIDE.md b/CPP_STYLE_GUIDE.md index 3e7319c1f8..3bea5bb107 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 -- cgit v1.2.3