@@ -32,11 +32,11 @@ these rules:
3232
3333## Formatting  
3434
35- ## Left-leaning (C++ style) asterisks for pointer declarations  
35+ ###  Left-leaning (C++ style) asterisks for pointer declarations  
3636
3737` char* buffer; `  instead of ` char *buffer; ` 
3838
39- ## C++ style comments  
39+ ###  C++ style comments  
4040
4141Use C++ style comments (` // ` ) for both single-line and multi-line comments.
4242Comments should also start with uppercase and finish with a dot.
@@ -56,7 +56,7 @@ preferred style. Feel free to update old comments to the preferred style when
5656working on code in the immediate vicinity or when changing/improving those
5757comments.
5858
59- ## 2 spaces of indentation for blocks or bodies of conditionals  
59+ ###  2 spaces of indentation for blocks or bodies of conditionals  
6060
6161``` c++ 
6262if  (foo)
@@ -76,7 +76,7 @@ Braces are optional if the statement body only has one line.
7676
7777` namespace ` s receive no indentation on their own.
7878
79- ## 4 spaces of indentation for statement continuations  
79+ ###  4 spaces of indentation for statement continuations  
8080
8181``` c++ 
8282VeryLongTypeName very_long_result = SomeValueWithAVeryLongName +
@@ -85,7 +85,7 @@ VeryLongTypeName very_long_result = SomeValueWithAVeryLongName +
8585
8686Operators are before the line break in these cases.
8787
88- ## Align function arguments vertically  
88+ ###  Align function arguments vertically  
8989
9090``` c++ 
9191void  FunctionWithAVeryLongName (int parameter_with_a_very_long_name,
@@ -101,7 +101,7 @@ void FunctionWithAReallyReallyReallyLongNameSeriouslyStopIt(
101101    ...); 
102102``` 
103103
104- ## Initialization lists  
104+ ###  Initialization lists  
105105
106106Long initialization lists are formatted like this:
107107
@@ -115,7 +115,7 @@ HandleWrap::HandleWrap(Environment* env,
115115      handle_ (handle) {
116116``` 
117117
118- ## CamelCase for methods, functions, and classes 
118+ ###  CamelCase for methods, functions, and classes 
119119
120120Exceptions are simple getters/setters, which are named `property_name()` and 
121121`set_property_name()`, respectively. 
@@ -131,15 +131,15 @@ class FooBar {
131131}; 
132132``` 
133133
134- ## snake\_ case for local variables and parameters  
134+ ###  snake\_ case for local variables and parameters  
135135
136136``` c++ 
137137int  FunctionThatDoesSomething (const char*  important_string) {
138138  const char*  pointer_into_string = important_string;
139139}
140140``` 
141141
142- ## snake\_case\_ for private class fields 
142+ ###  snake\_case\_ for private class fields 
143143
144144```c++ 
145145class Foo { 
@@ -148,7 +148,7 @@ class Foo {
148148}; 
149149``` 
150150
151- ## snake\_ case\_  for C-like structs  
151+ ###  snake\_ case\_  for C-like structs  
152152For plain C-like structs snake_case can be used.
153153
154154``` c++ 
@@ -157,7 +157,7 @@ struct foo_bar {
157157}
158158``` 
159159
160- ## Space after `template` 
160+ ###  Space after `template` 
161161
162162```c++ 
163163template <typename T> 
@@ -167,16 +167,16 @@ class FancyContainer {
167167``` 
168168## Memory Management  
169169
170- ## Memory allocation  
170+ ###  Memory allocation  
171171
172172-  ` Malloc() ` , ` Calloc() ` , etc. from ` util.h `  abort in Out-of-Memory situations
173173-  ` UncheckedMalloc() ` , etc. return ` nullptr `  in OOM situations
174174
175- ## Use ` nullptr `  instead of ` NULL `  or ` 0 `   
175+ ###  Use ` nullptr `  instead of ` NULL `  or ` 0 `   
176176
177177What it says in the title.
178178
179- ## Ownership and Smart Pointers  
179+ ###  Ownership and Smart Pointers  
180180
181181"Smart" pointers are classes that act like pointers, e.g.
182182by overloading the ` * `  and ` -> `  operators. Some smart pointer types can be
@@ -202,14 +202,14 @@ Never use `std::auto_ptr`. Instead, use `std::unique_ptr`.
202202
203203## Others 
204204
205- ## Type casting 
205+ ###  Type casting 
206206
207207- Always avoid C-style casts (`(type)value`) 
208208- `dynamic_cast` does not work because RTTI is not enabled 
209209- Use `static_cast` for casting whenever it works 
210210- `reinterpret_cast` is okay if `static_cast` is not appropriate 
211211
212- ## Do not include `*.h` if `*-inl.h` has already been included 
212+ ###  Do not include `*.h` if `*-inl.h` has already been included 
213213
214214Do 
215215
@@ -224,7 +224,7 @@ instead of
224224#include  " util-inl.h" 
225225``` 
226226
227- ## Avoid throwing JavaScript errors in C++  
227+ ###  Avoid throwing JavaScript errors in C++  
228228
229229When there is a need to throw errors from a C++ binding method, try to
230230return the data necessary for constructing the errors to JavaScript,
@@ -278,7 +278,7 @@ exports.foo = function(str) {
278278}; 
279279``` 
280280
281- ### Avoid throwing JavaScript errors in nested C++ methods  
281+ ####  Avoid throwing JavaScript errors in nested C++ methods  
282282
283283When you have to throw the errors from C++, try to do it at the top level and
284284not inside of nested calls.
0 commit comments