forked from dlang/dlang.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glossary.dd
214 lines (183 loc) · 6.49 KB
/
glossary.dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
Ddoc
$(D_S Glossary,
$(DL
$(DT $(LNAME2 blit, $(ACRONYM BLIT, Block Transfer)))
$(DD Also known as BLT, blit refers to copying memory
byte by byte. In C, this is referred to as a memcpy
operation.
The name originated with the BLT instruction on the
DEC PDP-10 computer.
)
$(DT $(LNAME2 ctfe, $(ACRONYM CTFE, Compile Time Function Evaluation)))
$(DD Refers to the ability to execute regular D
functions at compile time rather than at run time.)
$(DT $(LNAME2 cow, $(ACRONYM COW, Copy On Write)))
$(DD COW is a memory allocation strategy where arrays are copied
if they are to be modified.
)
$(DT $(LNAME2 data_race, Data Race)) $(DD One thread reading or writing
a memory location while another thread is reading or writing that same location.
)
$(DT $(LNAME2 functor, Functor)) $(DD An user-defined type (struct or
class) that defines the function call operator ($(DC opCall) in D) and
as such can be used similarly to a function.
)
$(DT $(LNAME2 gc, $(ACRONYM GC, Garbage Collection)))
$(DD Garbage collection is the common name for the
term automatic memory management. Memory can be allocated and used,
and the GC will automatically free any chunks of memory no longer
referred to. In contrast, explicit memory management
is where the programmer must carefully match up each allocation with
one and only one free.
)
$(DT Higher-order function) $(DD A function that either accepts another
function as a parameter, returns a function, or both.
)
$(DT Illegal)
$(DD A code construct is illegal if it does not conform to the
D language specification.
This may be true even if the compiler or runtime fails to detect
the error.
)
$(DT Input range) $(DD A type (i.e., a struct or a class) that
defines the member functions empty, head, and next. Input ranges
are assumed to be strictly one-pass: there is no way to save the
state of the iteration in a copy of the range. See also $(LINK2
../phobos/std_range.html,range).)
$(DT Implementation Defined Behavior)
$(DD This is variation in behavior of the D language in a manner
that is up to the implementor of the language.
An example of implementation defined behavior would be the size in
bytes of a pointer: on a 32 bit machine it would be 4 bytes, on
a 64 bit machine it would be 8 bytes.
Minimizing implementation defined behavior in the language will
maximize the portability of code.
)
$(DT $(LNAME2 nrvo, $(ACRONYM NRVO, Named Return Value Optimization)))
$(DD
$(P NRVO is a technique invented by Walter Bright around
1991 (the term for it was coined later) to minimize copying of struct
data.
Functions normally return their function return values in
registers. For structs, however, they often are too big to
fit in registers. The usual solution to this is to pass to
the function a $(I hidden pointer) to a struct instance in the
caller's stack frame, and the return value is copied there.
For example:
)
---
struct S { int a, b, c, d; }
S foo()
{
S result;
result.a = 3;
return result;
}
void test()
{
S s = foo();
}
---
$(P is rewritten as:)
---
S* foo(S* hidden)
{
S result;
result.a = 3;
*hidden = result;
return hidden;
}
void test()
{
S tmp;
S s = *foo(&tmp);
}
---
$(P This rewrite gives us an extra temporary object $(TT tmp),
and copies the struct contents twice.
What NRVO does is recognize that the sole purpose of $(TT result)
is to provide a return value, and so all references to $(TT result)
can be replaced with $(TT *hidden).
$(TT foo) is then rewritten as:
)
---
S* foo(S* hidden)
{
hidden.a = 3;
return hidden;
}
---
$(P A further optimization is done on the call to $(TT foo) to eliminate
the other copy, giving:)
---
void test()
{
S s;
foo(&s);
}
---
$(P The result is written directly into the destination $(TT s),
instead of passing through two other instances.)
)
$(DT $(LNAME2 opApply, opApply))
$(DD A special member function used to iterate over a
collection; this is used by the
$(LINK2 statement.html#opApply, $(I ForeachStatement)).
)
$(DT $(LNAME2 opApplyReverse, opApplyReverse))
$(DD A special member function used to iterate over a
collection in the reverse order; this is used by the
$(LINK2 statement.html#opApplyReverse, $(I ForeachStatement)).
)
$(DT $(LNAME2 pod, $(ACRONYM POD, Plain Old Data)))
$(DD Refers to a struct that contains no hidden members,
does not have virtual functions, does not inherit,
has no destructor,
and can be initialized and copied via simple bit copies.
D structs are POD.
)
$(DT $(LNAME2 predicate, Predicate)) $(DD A function or
delegate returning a Boolean result. Predicates can be nullary
(take no arguments), unary (take one argument), binary (take
two arguments), or n-ary (take n arguments). Usually
predicates are mentioned within the context of higher-order
functions, which accept predicates as parameters.
)
$(DT $(LNAME2 raii, $(ACRONYM RAII, Resource Acquisition Is Initialization)))
$(DD RAII refers to the technique of having the destructor
of a class object called when the object goes out of scope.
The destructor then releases any resources acquired by
that object.
RAII is commonly used for resources that are in short supply
or that must have a predictable point when they are released.
RAII objects in D are created using the $(TT scope) storage class.
)
$(DT $(LNAME2 sequential_consistency, Sequential Consistency))
$(DD Data being written in one order in one thread
being visible in the same order to another thread.
)
$(DT $(LNAME2 sfinae, $(ACRONYM SFINAE, Substitution Failure Is Not An Error)))
$(DD If template argument deduction results in a type
that is not valid, that specialization of the template
is not considered further. It is not a compile error.
See also $(LINK2 http://www.semantics.org/once_weakly/w02_SFINAE.pdf, SFINAE).
)
$(DT $(LNAME2 tmp, $(ACRONYM TMP, Template Metaprogramming)))
$(DD TMP is using the template features of the language to
execute programs at compile time rather than runtime.)
$(DT $(LNAME2 tls, $(ACRONYM TLS, Thread Local Storage)))
$(DD TLS allocates each thread its own instance of the
global data. See also
$(LINK2 http://en.wikipedia.org/wiki/Thread-Specific_Storage, Wikipedia).)
$(DT $(LNAME2 undefined_behavior, $(ACRONYM UB, Undefined Behavior)))
$(DD Undefined behavior happens when an illegal code construct is
executed. Undefined behavior can include random, erratic results,
crashes, faulting, etc.
A buffer overflow is an example of undefined behavior.
)
)
)
Macros:
TITLE=Glossary
WIKI=Glossary
CATEGORY_APPENDICES=$0