Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
7639 views
1
Functions should be named according to one of the following schemes:
2
3
verb_noun
4
verb_noun_with_noun
5
6
noun_attribute
7
get_noun_attribute -- when the 'noun_attribute' name conflicts with a type
8
set_noun_attribute
9
10
Prefixes are mandatory for exported functions, macros, enums, globals and types.
11
12
fz for common code
13
pdf, xps, etc., for interpreter specific code
14
15
Prefixes are optional (but encouraged) for private functions and types.
16
17
Avoid using 'get' as this is a meaningless and redundant filler word.
18
19
These words are reserved for reference counting schemes:
20
21
new, find, load, open, keep -- return objects that you are responsible for freeing.
22
23
drop, free, close -- relinquish ownership of the object passed in.
24
25
When searching for an object or value, the name used depends on whether
26
returning the value is passing ownership:
27
28
lookup -- return a value or borrowed pointer
29
30
find -- return an object that the caller is responsible for freeing
31
32