@@ -22,7 +22,10 @@ $(GNAME FuncDeclaratorSuffix):
22
22
$(GLINK2 template, TemplateParameters) $(GLINK Parameters) $(GLINK MemberFunctionAttributes)$(OPT) $(GLINK2 template, Constraint)$(OPT)
23
23
)
24
24
25
- * A *FuncDeclaration* with a $(GLINK FunctionBody) is called a *function definition*.
25
+ * A *FuncDeclaration* with a function body is called a
26
+ $(RELATIVE_LINK2 function-bodies, function definition).
27
+ * A *FuncDeclaration* without a function body is called a
28
+ $(RELATIVE_LINK2 function-declarations, function prototype).
26
29
* A *FuncDeclaration* with *TemplateParameters* defines a
27
30
$(DDSUBLINK spec/template, function-templates, function template).
28
31
@@ -135,7 +138,7 @@ $(LEGACY_LNAME2 FunctionLiteralBody)
135
138
This syntax also applies for $(DDSUBLINK spec/expression, function_literals, function literals).)
136
139
137
140
138
- $(H3 $(LNAME2 function-declarations, Functions without Bodies ))
141
+ $(H3 $(LNAME2 function-declarations, Function Prototypes ))
139
142
140
143
$(GRAMMAR
141
144
$(GNAME MissingFunctionBody):
@@ -144,16 +147,23 @@ $(GNAME MissingFunctionBody):
144
147
$(GLINK FunctionContracts)$(OPT) $(GLINK InOutStatement)
145
148
)
146
149
147
- $(P Functions without bodies :)
150
+ $(P Function declarations with a *MissingFunctionBody*, e.g. :)
148
151
149
152
---
150
153
int foo();
151
154
---
152
155
153
- $(P that are not declared as $(D abstract) are expected to have their implementations
156
+ $(P that are not declared as $(DDSUBLINK spec/class, abstract, `abstract`)
157
+ are expected to have their implementations
154
158
elsewhere, and that implementation will be provided at the link step.
155
159
This enables an implementation of a function to be completely hidden from the user
156
160
of it, and the implementation may be in another language such as C, assembler, etc.
161
+ Typically a function prototype would have non-`extern(D)`
162
+ $(DDSUBLINK spec/attribute, linkage, linkage).
163
+ )
164
+
165
+ $(P A function prototype can have `extern(D)` linkage.
166
+ This is useful for $(DDSUBLINK dmd, interface-files, D interface files).
157
167
)
158
168
159
169
0 commit comments