Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 71fa9c6

Browse filesBrowse files
lundibundidanielleadams
authored andcommitted
doc: add note regarding file structure in src/README.md
Refs: #34944 (comment) Co-authored-by: Anna Henningsen <anna@addaleax.net> PR-URL: #35000 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent d6bd78f commit 71fa9c6
Copy full SHA for 71fa9c6

File tree

Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+24
-0
lines changed
Open diff view settings
Collapse file

‎src/README.md‎

Copy file name to clipboardExpand all lines: src/README.md
+24Lines changed: 24 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,30 @@ the [event loop][] and other operation system abstractions to Node.js.
3838

3939
There is a [reference documentation for the libuv API][].
4040

41+
## File structure
42+
43+
The Node.js C++ files follow this structure:
44+
45+
The `.h` header files contain declarations, and sometimes definitions that don’t
46+
require including other headers (e.g. getters, setters, etc.). They should only
47+
include other `.h` header files and nothing else.
48+
49+
The `-inl.h` header files contain definitions of inline functions from the
50+
corresponding `.h` header file (e.g. functions marked `inline` in the
51+
declaration or `template` functions). They always include the corresponding
52+
`.h` header file, and can include other `.h` and `-inl.h` header files as
53+
needed. It is not mandatory to split out the definitions from the `.h` file
54+
into an `-inl.h` file, but it becomes necessary when there are multiple
55+
definitions and contents of other `-inl.h` files start being used. Therefore, it
56+
is recommended to split a `-inl.h` file when inline functions become longer than
57+
a few lines to keep the corresponding `.h` file readable and clean. All visible
58+
definitions from the `-inl.h` file should be declared in the corresponding `.h`
59+
header file.
60+
61+
The `.cc` files contain definitions of non-inline functions from the
62+
corresponding `.h` header file. They always include the corresponding `.h`
63+
header file, and can include other `.h` and `-inl.h` header files as needed.
64+
4165
## Helpful concepts
4266

4367
A number of concepts are involved in putting together Node.js on top of V8 and

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.