22
33$(COMMUNITY D's Contract Programming vs C++'s,
44
5+ $(HEADERNAV_TOC)
6+
57 $(P Many people have written me saying that D's Contract Programming
68 does not add anything that C++ does not already support.
79 They go on to illustrate their point with a technique for doing Contracts in
@@ -16,7 +18,7 @@ $(COMMUNITY D's Contract Programming vs C++'s,
1618 to support Contracts, but they are not covered here because they are not
1719 part of standard C++ and are not supported by any other C++ compiler.)
1820
19- $(H2 Contract Programming in D)
21+ $(H2 $(LNAME2 contract-programming-d, Contract Programming in D) )
2022
2123 This is more fully documented in the D
2224 <a href="contracts.html">Contract Programming</a> document.
@@ -64,9 +66,9 @@ $(H2 Contract Programming in D)
6466
6567 )
6668
67- $(H2 Contract Programming in C++)
69+ $(H2 $(LNAME2 contract-progamming-cpp, Contract Programming in C++) )
6870
69- $(H3 The $(D assert) Macro)
71+ $(H3 $(LNAME2 assert-macro, The $(D assert) Macro) )
7072
7173 $(P C++ does have the basic $(D assert) macro, which tests its argument
7274 and if it fails, aborts the program. $(D assert) can be turned
@@ -80,7 +82,7 @@ $(H3 The $(D assert) Macro)
8082 $(P $(D assert) is where explicit support for Contracts in Standard C++
8183 begins and ends.)
8284
83- $(H3 Class Invariants)
85+ $(H3 $(LNAME2 class-invariant, Class Invariants) )
8486
8587 Consider a class invariant in D:
8688
@@ -215,7 +217,7 @@ int A::foo()
215217 The #if DBC is still there because some compilers may not
216218 optimize the whole thing away if check_invariants compiles to nothing.
217219
218- $(H2 Preconditions and Postconditions)
220+ $(H3 Preconditions and Postconditions)
219221
220222 Consider the following in D:
221223
@@ -366,7 +368,7 @@ int foo(int a, int b)
366368}
367369)
368370
369- $(H2 Preconditions and Postconditions for Member Functions)
371+ $(H3 $(LNAME2 pre-post-conditions, Preconditions and Postconditions for Member Functions) )
370372
371373 Consider the use of preconditions and postconditions for a
372374 polymorphic function in D:
@@ -464,7 +466,7 @@ public:
464466 and parameters
465467 for $(D foo()).
466468
467- $(H2 Conclusion)
469+ $(H2 $(LNAME2 conclusion, Conclusion) )
468470
469471 $(P These C++ techniques can work up to a point. But, aside from
470472 $(D assert), they are not standardized and so will vary from
@@ -476,7 +478,7 @@ $(H2 Conclusion)
476478 way to use Contracts and get it right. Being in the language standardizes
477479 the way it will be used from project to project.)
478480
479- $(H2 References)
481+ $(H2 $(LNAME2 references, References) )
480482
481483 $(P Chapter C.11 introduces the theory and rationale of
482484 Contract Programming in
@@ -495,5 +497,6 @@ $(H2 References)
495497
496498Macros:
497499 TITLE=D's Contract Programming vs C++'s
500+ SUBNAV=$(SUBNAV_ARTICLES)
498501
499502
0 commit comments