@@ -4,6 +4,8 @@ $(SPEC_S Better C,
4
4
5
5
$(HEADERNAV_TOC)
6
6
7
+ $(H2 $(LNAME2 linking, Linking))
8
+
7
9
$(P It is straightforward to link C functions and libraries into D programs.
8
10
But linking D functions and libraries into C programs is not straightforward.
9
11
)
@@ -22,11 +24,14 @@ $(HEADERNAV_TOC)
22
24
a subset of D that fits this requirement, called $(B BetterC).
23
25
)
24
26
27
+ $(H2 $(LNAME2 better-c, Better C))
28
+
25
29
$(IMPLEMENTATION_DEFINED $(B BetterC) is typically enabled by setting the $(TT -betterC)
26
30
command line flag for the implementation.
27
31
)
28
32
29
- $(P When $(B BetterC) is enabled, the predefined $(LINK2 version.html, version) `D_BetterC`
33
+ $(P When $(B BetterC) is enabled, the predefined
34
+ $(DDLINK spec/version, Conditional Compilation, version) `D_BetterC`
30
35
can be used for conditional compilation.
31
36
)
32
37
@@ -63,7 +68,7 @@ Hello betterC
63
68
be tricky, hence removing D's GC from the equation may be worthwhile sometimes.)
64
69
)
65
70
66
- $(P BetterC and $(LINK2 https://dlang.org/ spec/importc.html , ImportC) are very different.
71
+ $(NOTE BetterC and $(DDLINK spec/importc, ImportC , ImportC) are very different.
67
72
ImportC is an actual C compiler. BetterC is a subset of D that relies only on the
68
73
existence of the C Standard library.)
69
74
@@ -82,7 +87,7 @@ $(H2 $(LNAME2 retained, Retained Features))
82
87
$(LI RAII (yes, it can work without exceptions))
83
88
$(LI `scope(exit)`)
84
89
$(LI Memory safety protections)
85
- $(LI Interfacing with C++)
90
+ $(LI $(DDLINK spec/cpp_interface, Interfacing to C++, Interfacing to C++) )
86
91
$(LI COM classes and C++ classes)
87
92
$(LI `assert` failures are directed to the C runtime library)
88
93
$(LI `switch` with strings)
@@ -93,7 +98,7 @@ $(H2 $(LNAME2 retained, Retained Features))
93
98
94
99
$(H3 $(LNAME2 unittests, Running unittests in `-betterC`))
95
100
96
- While, testing can be done without the $(TT -betterC) flag, it is sometimes desirable to run the testsuite in `-betterC` too.
101
+ While testing can be done without the $(TT -betterC) flag, it is sometimes desirable to run the testsuite in `-betterC` too.
97
102
`unittest` blocks can be listed with the $(DDSUBLINK spec/traits, getUnitTests, `getUnitTests`) trait:
98
103
99
104
---
@@ -114,7 +119,7 @@ $(GT) dmd -betterC -unittest -run test.d
114
119
dmd_runpezoXK: foo.d:3: Assertion `0' failed.
115
120
)
116
121
117
- However, in `-betterC` `assert` expressions don't use Druntime's assert and are directed to `assert` of the C runtime library instead.
122
+ However, in `-betterC`, `assert` expressions don't use Druntime's assert and are directed to `assert` from the C runtime library instead.
118
123
119
124
$(H2 $(LNAME2 consequences, Unavailable Features))
120
125
125
130
$(LI TypeInfo and $(DDSUBLINK spec/abi, ModuleInfo, $(TT ModuleInfo)))
126
131
$(LI Classes)
127
132
$(LI Built-in threading (e.g. $(MREF core, thread)))
128
- $(LI Dynamic arrays (though slices of static arrays work) and associative arrays)
133
+ $(LI Dynamic arrays (though slices of static arrays and pointers work))
134
+ $(LI Associative arrays)
129
135
$(LI Exceptions)
130
136
$(LI `synchronized` and $(MREF core, sync))
131
137
$(LI Static module constructors or destructors)
0 commit comments