14 changes: 7 additions & 7 deletions changelog.dd
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ $(VERSION 049, Sep 13, 2010, =================================================,
$(LI std.traits: hasLocalAliasing, hasLocalObjects and hasLocalRawAliasing are now hasUnsharedAliasing, hasUnsharedObjects and hasUnsharedRawAliasing. Aliases to the old names are included for now for backwards compatibility.)
$(LI std.typetuple: Added anySatisfy.)
$(LI std.array: Modified Appender's interface to fix memory issues.
Note that appending via $(TT ~=) and using appender on the same array
Note that appending via $(D ~=) and using appender on the same array
will not interleave anymore.)
$(LI $(BUGZILLA 2477): Trailing comma in array literal sometimes accepted, sometimes not)
)
Expand Down Expand Up @@ -2173,7 +2173,7 @@ $(VERSION 022, Dec 11, 2008, =================================================,
that extern(Windows).)
$(LI Pure functions now get semantically checked.)
$(LI Nothrow functions now get semantically checked.)
$(LI $(TT shared) is now a type constructor.)
$(LI $(D shared) is now a type constructor.)
)
$(BUGSFIXED
$(LI $(BUGZILLA 1518): Crash using 'scope', 'with' and undefined 'RegExp')
Expand All @@ -2195,7 +2195,7 @@ $(VERSION 022, Dec 11, 2008, =================================================,
$(LI $(BUGZILLA 2503): Error 42: Symbol Undefined _D3std7process6systemFAyaZi)
$(LI $(BUGZILLA 2506): Can't initialize const member in ctor if it is accessed via this.member syntax)
$(LI Incorporated some of the patches from $(BUGZILLA 1752))
$(LI $(TT extern __thread) now works on Linux.)
$(LI $(D extern __thread) now works on Linux.)
)
)

Expand Down Expand Up @@ -2516,7 +2516,7 @@ $(VERSION 014, May 16, 2008, =================================================,
$(LI Rewrote the $(LINK2 rdmd.html,$(B rdmd)) utility to properly track
dependencies and command-line compiler options (currently only working
under Linux).)
$(LI Changed the Phobos makefile $(TT linux.mak) to take advantage of
$(LI Changed the Phobos makefile $(D linux.mak) to take advantage of
the new $(B -lib) feature. Improved full build speed by 3x.)
$(LI std.algorithm: Changed the map() function so that it deduces the return type. Also map can be now curried.)
$(LI std.contracts: Added file and line information to enforce. Added errnoEnforce that formats the error message according to errno. Added corresponding ErrnoException class.)
Expand Down Expand Up @@ -2939,11 +2939,11 @@ $(BUGSFIXED
$(VERSION 005, Oct 1, 2007, =================================================,

$(WHATSNEW
$(LI $(TT std.math.sin), $(TT cos), $(TT tan) are now evaluated at
$(LI $(D std.math.sin), $(D cos), $(D tan) are now evaluated at
compile time if the argument is a constant.)
$(LI Added Cristian Vlasceanu's idea for
$(LINK2 cpp_interface.html, C++ interface) for 'plugins')
$(LI Overhaul phobos $(TT linux.mak) and add documentation build logic)
$(LI Overhaul phobos $(D linux.mak) and add documentation build logic)
$(LI Massive additions to $(LINK2 phobos/std_conv.html, std.conv))
$(LI Add $(CODE writeln()) and $(CODE write()) to $(LINK2 phobos/std_stdio.html, std.stdio))
)
Expand Down Expand Up @@ -3186,4 +3186,4 @@ Macros:
NEWPHOBOS = <div id="whatsnew"><h4>New/Changed Phobos</h4> $(UL $0 )</div>
LARGE=<font size=4>$0</font>
TRENAME=$(TR $(TD $(CODE $1)) $(TD $(CODE $2)))
LII= $(LI $(TT $1) $(UL $+ ))
LII= $(LI $(D $1) $(UL $+ ))
16 changes: 8 additions & 8 deletions class.dd
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ $(GNAME StaticConstructor):

A static constructor is defined as a function that performs
initializations before the
$(TT main()) function gets control. Static constructors are used to
$(D main()) function gets control. Static constructors are used to
initialize
static class members
with values that cannot be computed at compile time.
Expand Down Expand Up @@ -489,7 +489,7 @@ class Foo {
initializations, and it is not possible to read a value that has not
been initialized. Dynamic
initialization is performed by a static constructor, defined with
a special syntax $(TT static this()).
a special syntax $(D static this()).

------
class Foo {
Expand All @@ -505,8 +505,8 @@ class Foo {
}
------

$(TT static this()) is called by the startup code before
$(TT main()) is called. If it returns normally
$(D static this()) is called by the startup code before
$(D main()) is called. If it returns normally
(does not throw an exception), the static destructor is added
to the list of functions to be
called on program termination.
Expand Down Expand Up @@ -543,7 +543,7 @@ $(GNAME StaticDestructor):
)

A static destructor is defined as a special static function with the
syntax $(TT static ~this()).
syntax $(D static ~this()).

------
class Foo {
Expand Down Expand Up @@ -668,7 +668,7 @@ assert(mydate); // check that class Date invariant holds
------

Invariants contain assert expressions, and so when they fail,
they throw a $(TT AssertError)s.
they throw a $(D AssertError)s.
Class invariants are inherited, that is,
any class invariant is implicitly anded with the invariants of its base
classes.
Expand Down Expand Up @@ -711,7 +711,7 @@ new Foo;
set to the size in bytes of the memory to be allocated for the
instance.
The allocator must allocate the memory and return it as a
$(TT void*).
$(D void*).
If the allocator fails, it must not return a $(B null), but
must throw an exception.
If there is more than one parameter to the allocator, the
Expand Down Expand Up @@ -760,7 +760,7 @@ delete(void *p) {
------

is called a class deallocator.
The deallocator must have exactly one parameter of type $(TT void*).
The deallocator must have exactly one parameter of type $(D void*).
Only one can be specified for a class.
When a delete expression:

Expand Down
14 changes: 7 additions & 7 deletions code_coverage.dd
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ dmd sieve -cov
sieve
)

$(P The output file will be created called $(TT sieve.lst), the contents of
$(P The output file will be created called $(D sieve.lst), the contents of
which are:)

$(CONSOLE
Expand Down Expand Up @@ -155,11 +155,11 @@ At the end of the .lst file, the percent coverage is given.
)

$(P There are 3 lines with an exection count
of 1, these were each executed once. The declaration line for $(TT i, prime),
of 1, these were each executed once. The declaration line for $(D i, prime),
etc., has 5 because there are 5 declarations, and the initialization of
each declaration counts as one statement.)

$(P The first $(TT for) loop shows 22. This is the sum of the 3 parts
$(P The first $(D for) loop shows 22. This is the sum of the 3 parts
of the for header. If the for header is broken up into 3 lines, the
data is similarly divided:)

Expand All @@ -171,8 +171,8 @@ $(CONSOLE

$(P which adds up to 22.)

$(P $(TT e1&amp;&amp;e2) and $(TT e1||e2) expressions conditionally
execute the rvalue $(TT e2).
$(P $(D e1&amp;&amp;e2) and $(D e1||e2) expressions conditionally
execute the rvalue $(D e2).
Therefore, the rvalue is treated as a separate statement with its own
counter:)

Expand All @@ -197,8 +197,8 @@ $(CONSOLE
|}
)

$(P Similarly, for the $(TT e?e1:e2) expressions, $(TT e1) and
$(TT e2) are treated as separate statements.)
$(P Similarly, for the $(D e?e1:e2) expressions, $(D e1) and
$(D e2) are treated as separate statements.)

<h3>Controlling the Coverage Analyser</h3>

Expand Down
4 changes: 2 additions & 2 deletions comparison.dd
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ $(SECTION2 Notes,
however, they are not part of the core language.
A conforming freestanding implementation of C++ (C++98 17.4.1.3) does
not need to provide these libraries.
Here's a <a href="cppstrings.html">comparison</a> of C++ strings
and D built-in strings.
$(REDO Here's a <a href="cppstrings.html">comparison</a> of C++ strings
and D built-in strings.)
<p>

<dt><a name="StrongTypedefs">Strong typedefs</a>
Expand Down
7 changes: 3 additions & 4 deletions const-faq.dd
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ Ddoc

$(D_S const(FAQ),

$(P D's const system is unique, and so there are a lot of
questions about it.
)
$(P D's $(D const)/$(D immutable) system is unique, and so there
are a lot of questions about it. )

$(UL

Expand Down Expand Up @@ -69,7 +68,7 @@ $(ITEM const, Why does D have const?)
fairly modest size, const is not particularly useful.
And in D const can be effectively ignored by just not using it, or
by using D 1.0. The only place const is imposed is with the immutable
string type.
string type.
)

$(ITEM principles, What principles drove the D const design?)
Expand Down
467 changes: 0 additions & 467 deletions const.dd

This file was deleted.

46 changes: 23 additions & 23 deletions cppdbc.dd
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,20 @@ $(COMMUNITY D's Contract Programming vs C++'s,

<h2>Contract Programming in C++</h2>

<h3>The $(TT assert) Macro</h3>
<h3>The $(D assert) Macro</h3>

C++ does have the basic $(TT assert) macro, which tests its argument
and if it fails, aborts the program. $(TT assert) can be turned
on and off with the $(TT NDEBUG) macro.
C++ does have the basic $(D assert) macro, which tests its argument
and if it fails, aborts the program. $(D assert) can be turned
on and off with the $(D NDEBUG) macro.
<p>

$(TT assert) does not know anything about class invariants,
$(D assert) does not know anything about class invariants,
and does not throw an exception when it fails. It just aborts
the program after writing a message. $(TT assert) relies on
the program after writing a message. $(D assert) relies on
a macro text preprocessor to work.
<p>

$(TT assert) is where explicit support for DbC in Standard C++
$(D assert) is where explicit support for DbC in Standard C++
begins and ends.

<h3>Class Invariants</h3>
Expand Down Expand Up @@ -162,8 +162,8 @@ void B::barG()
}
)

There's an additional complication with $(TT A::foo()). Upon every
normal exit from the function, the $(TT invariant()) should be
There's an additional complication with $(D A::foo()). Upon every
normal exit from the function, the $(D invariant()) should be
called.
This means that code that looks like:

Expand Down Expand Up @@ -247,14 +247,14 @@ void foo()
)

If the preconditions and postconditions consist of nothing
more than $(TT assert) macros, the whole doesn't need to
be wrapped in a $(TT #ifdef) pair, since a good C++ compiler will
optimize the whole thing away if the $(TT assert)s are turned off.
more than $(D assert) macros, the whole doesn't need to
be wrapped in a $(D #ifdef) pair, since a good C++ compiler will
optimize the whole thing away if the $(D assert)s are turned off.
<p>

But suppose $(TT foo()) sorts an array, and the postcondition needs
But suppose $(D foo()) sorts an array, and the postcondition needs
to walk the array and verify that it really is sorted. Now
the shebang needs to be wrapped in $(TT #ifdef):
the shebang needs to be wrapped in $(D #ifdef):

$(CCODE
void foo()
Expand All @@ -270,12 +270,12 @@ void foo()
)

(One can make use of the C++ rule that templates are only
instantiated when used can be used to avoid the $(TT #ifdef), by
instantiated when used can be used to avoid the $(D #ifdef), by
putting the conditions into a template function referenced
by the $(TT assert).)
by the $(D assert).)
<p>

Let's add a return value to $(TT foo()) that needs to be checked in
Let's add a return value to $(D foo()) that needs to be checked in
the postconditions. In D:

----------
Expand Down Expand Up @@ -318,7 +318,7 @@ int foo()
}
)

Now add a couple parameters to $(TT foo()). In D:
Now add a couple parameters to $(D foo()). In D:

----------
int foo(int a, int b)
Expand Down Expand Up @@ -394,7 +394,7 @@ class B : A
}
----------

The semantics for a call to $(TT B.foo()) are:
The semantics for a call to $(D B.foo()) are:

$(UL
$(LI Either Apreconditions or Bpreconditions must be satisfied.)
Expand Down Expand Up @@ -457,16 +457,16 @@ public:
)

Something interesting has happened here. The preconditions can
no longer be done using $(TT assert), since the results need
no longer be done using $(D assert), since the results need
to be OR'd together. I'll leave as a reader exercise adding
in a class invariant, function return values for $(TT foo()),
in a class invariant, function return values for $(D foo()),
and parameters
for $(TT foo()).
for $(D foo()).

<h2>Conclusion</h2>

These C++ techniques can work up to a point. But, aside from
$(TT assert), they are not standardized and so will vary from
$(D assert), they are not standardized and so will vary from
project to project. Furthermore, they require much tedious
adhesion to a particular convention, and add significant clutter
to the code. Perhaps that's why it's rarely seen in practice.
Expand Down
8 changes: 4 additions & 4 deletions cppstrings.dd
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ void foo(char*);
char[] s1;
foo(s1.ptr);
-----------------------
$(P although for this to work where $(TT foo) expects a 0 terminated
string, $(TT s1) must have a terminating 0. Alternatively, the
function $(TT std.string.toStringz) will ensure it:)
$(P although for this to work where $(D foo) expects a 0 terminated
string, $(D s1) must have a terminating 0. Alternatively, the
function $(D std.string.toStringz) will ensure it:)

-----------------------
void foo(char*);
Expand Down Expand Up @@ -378,7 +378,7 @@ int main (char[][] args)
}
-----------------------

$(P (An $(LINK2 wc.html, alternate implementation) that
$(P (An $(LINK2 wc.html, alternate implementation) that
uses buffered file I/O to handle larger files.))

$(P
Expand Down
82 changes: 41 additions & 41 deletions cpptod.dd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $(UL
$(CPPCODE
class Foo
{
Foo(int x);
Foo(int x);
};
)

Expand All @@ -51,7 +51,7 @@ class Foo
------
class Foo
{
this(int x) { }
this(int x) { }
}
------

Expand All @@ -69,7 +69,7 @@ class A { A() {... } };
class B : A
{
B(int x)
: A() // call base constructor
: A() // call base constructor
{ ...
}
};)
Expand All @@ -84,20 +84,20 @@ class B : A
{
this(int x)
{ ...
super(); // call base constructor
super(); // call base constructor
...
}
}
------

It's superior to C++ in that the base constructor call can be flexibly placed anywhere in the derived
It's superior to C++ in that the base constructor call can be flexibly placed anywhere in the derived
constructor. D can also have one constructor call another one:

------
class A
{ int a;
int b;
this() { a = 7; b = foo(); }
this() { a = 7; b = foo(); }
this(int x)
{
this();
Expand All @@ -106,14 +106,14 @@ class A
}
------

Members can also be initialized to constants before the constructor is ever called, so the above example is
Members can also be initialized to constants before the constructor is ever called, so the above example is
equivalently written as:

------
class A
{ int a = 7;
int b;
this() { b = foo(); }
this() { b = foo(); }
this(int x)
{
this();
Expand All @@ -130,7 +130,7 @@ class A
While C++ defines struct assignment in a simple, convenient manner:

$(CPPCODE
struct A x, y;
struct A x, y;
...
x = y;
)
Expand All @@ -145,7 +145,7 @@ struct A x, y;

inline bool operator==(const A&amp; x, const A&amp; y)
{
return (memcmp(&amp;x, &amp;y, sizeof(struct A)) == 0);
return (memcmp(&amp;x, &amp;y, sizeof(struct A)) == 0);
}
...
if (x == y)
Expand Down Expand Up @@ -184,7 +184,7 @@ if (x == y)
------
A x, y;
...
if (x == y)
if (x == y)
...
------

Expand All @@ -204,15 +204,15 @@ void foo(void *);
void bar(Handle);

Handle h = HANDLE_INIT;
foo(h); // coding bug not caught
foo(h); // coding bug not caught
bar(h); // ok
)

The C++ solution is to create a dummy struct whose sole
purpose is to get type checking and overloading on the new type.

$(CPPCODE
#define HANDLE_INIT ((void *)(-1))
#define HANDLE_INIT ((void *)(-1))
struct Handle
{ void *ptr;

Expand All @@ -221,7 +221,7 @@ struct Handle

Handle(int i) { ptr = (void *)i; }

// conversion to underlying type
// conversion to underlying type
operator void*() { return ptr; }
};
void bar(Handle);
Expand All @@ -238,7 +238,7 @@ if (h != HANDLE_INIT)
No need for idiomatic constructions like the above. Just write:

------
typedef void* Handle = cast(void*)-1;
typedef void* Handle = cast(void*)-1;
void bar(Handle);

Handle h;
Expand All @@ -258,7 +258,7 @@ if (h != Handle.init)

Sometimes two classes are tightly related but not by inheritance,
but need to access each other's private members. This is done
using $(TT friend) declarations:
using $(D friend) declarations:

$(CPPCODE
class A
Expand All @@ -283,7 +283,7 @@ class B
};

int A::foo(B *j) { return j->b; }
int B::bar(A *j) { return j->a; }
int B::bar(A *j) { return j->a; }

int abc(A *p) { return p->a; }
)
Expand Down Expand Up @@ -313,13 +313,13 @@ class B
static int b;

public:
int bar(A j) { return j.a; }
int bar(A j) { return j.a; }
}

int abc(A p) { return p.a; }
------

The $(TT private) attribute prevents other modules from
The $(D private) attribute prevents other modules from
accessing the members.

<hr><!-- -------------------------------------------- -->
Expand All @@ -343,7 +343,7 @@ struct A
int operator &lt; (int i, A &a) { return a &gt; i; }
int operator &lt;= (int i, A &a) { return a &gt;= i; }
int operator &gt; (int i, A &a) { return a &lt; i; }
int operator &gt;= (int i, A &a) { return a &lt;= i; }
int operator &gt;= (int i, A &a) { return a &lt;= i; }
)

A total of 8 functions are necessary.
Expand All @@ -356,13 +356,13 @@ int operator &gt;= (int i, A &a) { return a &lt;= i; }
------
struct A
{
int opCmp(int i);
int opCmp(int i);
}
------

The compiler automatically interprets all the
&lt;, &lt;=, &gt; and &gt;=
operators in terms of the $(TT cmp) function, as well
operators in terms of the $(D cmp) function, as well
as handling the cases where the left operand is not an
object reference.
<p>
Expand Down Expand Up @@ -398,7 +398,7 @@ using foo::x;
module foo;
int x;

/** Another module **/
/** Another module **/
import foo;
alias foo.x x;
------
Expand All @@ -423,7 +423,7 @@ class File

~File()
{
h->release();
h->release();
}
};
)
Expand All @@ -433,7 +433,7 @@ class File
The bulk of resource release problems are simply keeping track
of and freeing memory. This is handled automatically in D by
the garbage collector. The second common resources used are semaphores
and locks, handled automatically with D's $(TT synchronized)
and locks, handled automatically with D's $(D synchronized)
declarations and statements.
<p>

Expand All @@ -455,7 +455,7 @@ void test()
if (...)
{ scope f = new File();
...
} // f.~this() gets run at closing brace, even if
} // f.~this() gets run at closing brace, even if
// scope was exited via a thrown exception
}
------
Expand All @@ -473,7 +473,7 @@ $(CPPCODE
class Abc
{
public:
void setProperty(int newproperty) { property = newproperty; }
void setProperty(int newproperty) { property = newproperty; }
int getProperty() { return property; }

private:
Expand All @@ -497,7 +497,7 @@ int x = a.getProperty();
------
class Abc
{
// set
// set
void property(int newproperty) { myprop = newproperty; }

// get
Expand All @@ -513,14 +513,14 @@ class Abc
------
Abc a;
a.property = 3; // equivalent to a.property(3)
int x = a.property; // equivalent to int x = a.property()
int x = a.property; // equivalent to int x = a.property()
------

Thus, in D a property can be treated like it was a simple field name.
A property can start out actually being a simple field name,
but if later if becomes
but if later if becomes
necessary to make getting and setting it function calls,
no code needs to be modified other
no code needs to be modified other
than the class definition.
It obviates the wordy practice of defining get and set properties
$(SINGLEQUOTE just in case) a derived class should need to override them.
Expand All @@ -540,7 +540,7 @@ $(CPPCODE
template&lt;int n&gt; class factorial
{
public:
enum { result = n * factorial&lt;n - 1&gt;::result };
enum { result = n * factorial&lt;n - 1&gt;::result };
};

template&lt;&gt; class factorial&lt;1&gt;
Expand Down Expand Up @@ -574,7 +574,7 @@ template factorial(int n : 1)

void test()
{
writefln("%d", factorial!(4)); // prints 24
writefln("%d", factorial!(4)); // prints 24
}
------

Expand Down Expand Up @@ -623,12 +623,12 @@ struct Integer&lt; 8 &gt;
typedef signed char int_type ;
} ;

struct Integer&lt; 16 &gt;
struct Integer&lt; 16 &gt;
{
typedef short int_type ;
} ;

struct Integer&lt; 32 &gt;
struct Integer&lt; 32 &gt;
{
typedef int int_type ;
} ;
Expand All @@ -640,15 +640,15 @@ struct Integer&lt; 64 &gt;

// If the required size is not supported, the metaprogram
// will increase the counter until an internal error is
// signaled, or INT_MAX is reached. The INT_MAX
// specialization does not define a int_type, so a
// signaled, or INT_MAX is reached. The INT_MAX
// specialization does not define a int_type, so a
// compiling error is always generated
struct Integer&lt; INT_MAX &gt;
{
} ;

// A bit of syntactic sugar
#define Integer( nbits ) Integer&lt; nbits &gt; :: int_type
#define Integer( nbits ) Integer&lt; nbits &gt; :: int_type

#include &lt;stdio.h&gt;

Expand All @@ -659,7 +659,7 @@ int main()
Integer( 29 ) k ;
Integer( 64 ) l ;
printf("%d %d %d %d\n",
sizeof(i), sizeof(j), sizeof(k), sizeof(l));
sizeof(i), sizeof(j), sizeof(k), sizeof(l));
return 0 ;
}
)
Expand Down Expand Up @@ -691,7 +691,7 @@ int main()
Integer&lt; 29 &gt; k ;
Integer&lt; 64 &gt; l ;
printf("%d %d %d %d\n",
sizeof(i), sizeof(j), sizeof(k), sizeof(l));
sizeof(i), sizeof(j), sizeof(k), sizeof(l));
return 0 ;
}
)
Expand Down Expand Up @@ -729,7 +729,7 @@ int main()
Integer!(29) k ;
Integer!(64) l ;
writefln("%d %d %d %d",
i.sizeof, j.sizeof, k.sizeof, l.sizeof);
i.sizeof, j.sizeof, k.sizeof, l.sizeof);
return 0;
}
------
Expand Down
818 changes: 409 additions & 409 deletions ctod.dd

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions dbc.dd
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $(SPEC_S Contract Programming,

Building contract support into the language makes for:

$(OL
$(OL
$(LI a consistent look and feel for the contracts)
$(LI tool support)
$(LI it's possible the compiler can generate better code using information gathered
Expand Down Expand Up @@ -123,23 +123,23 @@ void func()

$(P If a function in a derived class overrides a function in its
super class, then only one of
the $(TT in) contracts of the function and its base functions
the $(D in) contracts of the function and its base functions
must be satisfied.
Overriding
functions then becomes a process of $(I loosening) the $(TT in)
functions then becomes a process of $(I loosening) the $(D in)
contracts.
)

$(P A function without an $(TT in) contract means that any values
$(P A function without an $(D in) contract means that any values
of the function parameters are allowed. This implies that if any
function in an inheritance hierarchy has no $(TT in) contract,
then $(TT in) contracts on functions overriding it have no useful
function in an inheritance hierarchy has no $(D in) contract,
then $(D in) contracts on functions overriding it have no useful
effect.
)

$(P Conversely, all of the $(TT out) contracts needs to be satisfied,
$(P Conversely, all of the $(D out) contracts needs to be satisfied,
so overriding functions becomes a processes of $(I tightening) the
$(TT out)
$(D out)
contracts.
)

Expand Down
156 changes: 78 additions & 78 deletions dcompiler.dd

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ddoc.dd
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ declaration, it applies to that.

$(P
If a documentation comment for a declaration consists only of the
identifier $(TT ditto)
identifier $(D ditto)
then the documentation comment for the previous declaration at the same
declaration scope is applied to this declaration as well.
)
Expand Down Expand Up @@ -816,11 +816,11 @@ $(P
And all the summary sections will now be green.
)

<h3>Macro Definitions from $(LINK2 $(WEBURL)dmd-windows.html#sc_ini, $(TT sc.ini))'s DDOCFILE</h3>
<h3>Macro Definitions from $(LINK2 $(WEBURL)dmd-windows.html#sc_ini, $(D sc.ini))'s DDOCFILE</h3>

$(P
A text file of macro definitions can be created,
and specified in $(TT sc.ini):
and specified in $(D sc.ini):
)

$(DDOCCODE
Expand Down
60 changes: 30 additions & 30 deletions dll.dd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ $(D_S Writing Win32 DLLs in D,

$(P This guide will show how to create DLLs of various types with D.)

$(UL
$(UL
$(LI <a href="#Cinterface">DLLs with a C interface</a>)
$(LI <a href="#com">DLLs that are COM servers</a>)
$(LI <a href="#Dcode">D code calling D code in DLLs</a>)
Expand All @@ -29,7 +29,7 @@ $(D_S Writing Win32 DLLs in D,
)

$(P DLLs can be created in D in roughly the same way as in C.
A $(TT DllMain())
A $(D DllMain())
is required, looking like:
)

Expand Down Expand Up @@ -67,7 +67,7 @@ BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
-------------------------------

$(P Notes:)
$(UL
$(UL
$(LI DllMain simply forwards to the appropriate helper functions. These setup
the runtime, create thread objects for interaction with the garbage collector
and initialize thread local storage data.)
Expand All @@ -76,10 +76,10 @@ BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
should be controlled by the garbage collector. You might need more control over
this behaviour if there are threads in the process that must not be suspended.
In this case pass false to disable the automatic handling of all threads.)
$(LI The presence of $(TT DllMain()) is recognized by the compiler
$(LI The presence of $(D DllMain()) is recognized by the compiler
causing it to emit a reference to
$(LINK2 http://www.digitalmars.com/ctg/acrtused.html, __acrtused_dll)
and the $(TT phobos.lib) runtime library.)
and the $(D phobos.lib) runtime library.)
)

Link with a .def
Expand Down Expand Up @@ -132,7 +132,7 @@ DATA WRITE
)

$(P Put the code above that contains $(CODE DllMain()) into a file
$(TT dll.d).
$(D dll.d).
Compile and link the dll with the following command:
)

Expand Down Expand Up @@ -192,7 +192,7 @@ C:>

$(P There are many approaches to solving this problem:)

$(UL
$(UL

$(LI Do not return pointers to D gc allocated memory to the caller of
the DLL. Instead, have the caller allocate a buffer, and have the DLL
Expand Down Expand Up @@ -375,7 +375,7 @@ export MyClass $(B getMyClass)()
<dt>$(B DllMain)
<dd>This is the main entry point for any D DLL. It gets called
by the C startup code
(for DMC++, the source is $(TT \dm\src\win32\dllstart.c)).
(for DMC++, the source is $(D \dm\src\win32\dllstart.c)).
The $(B printf)'s are placed there so one can trace how it gets
called.
Notice that the initialization and termination code seen in
Expand Down Expand Up @@ -434,17 +434,17 @@ export MyClass $(B getMyClass)()

</dl>

To build the $(TT mydll.dll) DLL:
To build the $(D mydll.dll) DLL:

$(OL
$(LI$(B $(TT dmd -c mydll -g))
<br>Compiles $(TT mydll.d) into $(TT mydll.obj).
$(OL
$(LI$(B $(D dmd -c mydll -g))
<br>Compiles $(D mydll.d) into $(D mydll.obj).
$(B -g) turns on debug info generation.
)

$(LI $(B $(TT dmd mydll.obj mydll.def -g -L/map))
<br>Links $(TT mydll.obj) into a DLL named $(TT mydll.dll).
$(TT mydll.def) is the
$(LI $(B $(D dmd mydll.obj mydll.def -g -L/map))
<br>Links $(D mydll.obj) into a DLL named $(D mydll.dll).
$(D mydll.def) is the
<a href="http://www.digitalmars.com/ctg/ctgDefFiles.html">Module Definition File</a>,
and has the contents:

Expand All @@ -456,21 +456,21 @@ CODE PRELOAD DISCARDABLE
DATA PRELOAD SINGLE
)
$(B -g) turns on debug info generation, and
$(B -L/map) generates a map file $(TT mydll.map).
$(B -L/map) generates a map file $(D mydll.map).
)

$(LI $(B $(TT implib /noi /system mydll.lib mydll.dll))
$(LI $(B $(D implib /noi /system mydll.lib mydll.dll))
<br>Creates an
<a href="http://www.digitalmars.com/ctg/implib.html">import library</a>
$(TT mydll.lib) suitable
$(D mydll.lib) suitable
for linking in with an application that will be statically
loading $(TT mydll.dll).
loading $(D mydll.dll).
)

)

$(P Here's $(TT test.d), a sample application that makes use of
$(TT mydll.dll). There are two versions, one statically binds to
$(P Here's $(D test.d), a sample application that makes use of
$(D mydll.dll). There are two versions, one statically binds to
the DLL, and the other dynamically loads it.
)

Expand Down Expand Up @@ -561,14 +561,14 @@ $(CONSOLE
C:>dmd test mydll.lib -g
)

$(P Note how it is linked with $(TT mydll.lib), the import library
for $(TT mydll.dll).
The code is straightforward, it initializes $(TT mydll.lib) with
$(P Note how it is linked with $(D mydll.lib), the import library
for $(D mydll.dll).
The code is straightforward, it initializes $(D mydll.lib) with
a call to $(B MyDLL_Initialize)(), passing the handle
to $(TT test.exe)'s gc.
to $(D test.exe)'s gc.
Then, we can use the DLL and call its functions just as if
it were part of $(TT test.exe). In $(B foo)(), gc memory
is allocated and freed both by $(TT test.exe) and $(TT mydll.dll).
it were part of $(D test.exe). In $(B foo)(), gc memory
is allocated and freed both by $(D test.exe) and $(D mydll.dll).
When we're done using the DLL, it is terminated with
$(B MyDLL_Terminate)().
)
Expand All @@ -595,17 +595,17 @@ C:>
$(CONSOLE
C:>dmd test -version=DYNAMIC_LOAD -g
)
$(P The import library $(TT mydll.lib) is not needed.
$(P The import library $(D mydll.lib) is not needed.
The DLL is loaded with a call to
$(B Runtime.loadLibrary)(),
and each exported function has to be retrieved via
a call to
$(B GetProcAddress)().
An easy way to get the decorated name to pass to $(B GetProcAddress)()
is to copy and paste it from the generated $(TT mydll.map) file
is to copy and paste it from the generated $(D mydll.map) file
under the $(B Export) heading.
Once this is done, we can use the member functions of the
DLL classes as if they were part of $(TT test.exe).
DLL classes as if they were part of $(D test.exe).
When done, release the DLL with
$(B Runtime.unloadLibrary)().
)
Expand Down
1,023 changes: 0 additions & 1,023 deletions dnews.dd

This file was deleted.

19 changes: 7 additions & 12 deletions doc.ddoc
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,10 @@ NAVIGATION_COMMUNITY=
$(TOCENTRY ctod.html, Converting C to D)
$(TOCENTRY cpptod.html, Converting C++ to D)
$(TOCENTRY pretod.html, The C Preprocessor vs D)
$(TOCENTRY template-comparison.html, D templates compared)
$(TOCENTRY cppstrings.html, D strings vs C++ std::string)
$(REDO $(TOCENTRY template-comparison.html, D templates compared))
$(REDO $(TOCENTRY cppstrings.html, D strings vs C++ std::string))
$(TOCENTRY cppdbc.html, D Contract Programming vs C++)
$(TOCENTRY lisp-java-d.html, Lisp vs. Java... D?)
$(TOCENTRY cpp0x.html, D and C++0x)
$(REDO $(TOCENTRY cpp0x.html, D and C++0x))
)
</div>
$(BOOKS)
Expand Down Expand Up @@ -208,7 +207,6 @@ $(NAVBLOCK_HEADER $(TOCHEADER Community),
$(TOCENTRYT http://prowiki.org/wiki4d/wiki.cgi?ReviewQueue, Queue of current and upcoming standard library additions, Review queue)
$(TOCENTRYT http://twitter.com/#search?q=%23d_lang, #d_lang on twitter.com, Twitter)
$(TOCENTRYT http://digitalmars.com/d/dlinks.html, External D related links, Links)
$(TOCENTRYX http://digitalmars.com/d/dnews.html, News Digest)
$(TOCENTRYX http://d.puremagic.com/conference2008/, D Programming Language Conference, Conference)
)

Expand All @@ -220,11 +218,10 @@ $(NAVBLOCK
$(TOCENTRY ctod.html, Converting C to D)
$(TOCENTRY cpptod.html, Converting C++ to D)
$(TOCENTRY pretod.html, The C Preprocessor vs D)
$(TOCENTRY template-comparison.html, D templates compared)
$(TOCENTRY cppstrings.html, D strings vs C++ std::string)
$(TOCENTRY cppdbc.html, D Contract Programming vs C++)
$(TOCENTRY lisp-java-d.html, Lisp vs. Java... D?)
$(TOCENTRY cpp0x.html, D and C++0x)
$(REDO $(TOCENTRY template-comparison.html, D templates compared))
$(REDO $(TOCENTRY cppstrings.html, D strings vs C++ std::string))
$(REDO $(TOCENTRY cppdbc.html, D Contract Programming vs C++))
$(REDO $(TOCENTRY cpp0x.html, D and C++0x))
)

SUBNAV_FEATURES=
Expand Down Expand Up @@ -256,7 +253,6 @@ SUBNAV_FAQ=
$(NAVBLOCK
$(TOCENTRYT const-faq.html, Frequently Asked Questions about const, const(FAQ))
$(TOCENTRYT rationale.html, Answers to questions about D design decisions, Rationale)
$(TOCENTRYT future.html, Future directions, Future)
)

SUBNAV_APPENDICES=
Expand Down Expand Up @@ -300,7 +296,6 @@ $(NAVBLOCK
$(TOCENTRY interfaceToC.html, Interfacing To C)
$(TOCENTRY cpp_interface.html, Interfacing To C++)
$(TOCENTRY portability.html, Portability Guide)
$(TOCENTRY html.html, Embedding D in HTML)
$(TOCENTRY entity.html, Named Character Entities)
$(TOCENTRY memory-safe-d.html, Memory Safe D Spec)
$(TOCENTRY abi.html, Application Binary Interface)
Expand Down
2 changes: 1 addition & 1 deletion download.dd
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ $(BR)
)

$(TR
$(TD $(TT sudo apt-get install gdc))
$(TD $(D sudo apt-get install gdc))
$(TD $(DEBIAN) $(UBUNTU))
$(TD GDC)
)
Expand Down
44 changes: 22 additions & 22 deletions exception-safe.dd
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ Transaction abc()
<h3>Example</h3>

The next example involves temporarily changing the state of some object.
Suppose there's a class data member $(TT verbose), which controls the
Suppose there's a class data member $(D verbose), which controls the
emission of messages logging the activity of the class.
Inside one of the methods, $(TT verbose) needs to be turned off because
Inside one of the methods, $(D verbose) needs to be turned off because
there's a loop that would otherwise cause a blizzard of messages to be output:

---
Expand All @@ -271,7 +271,7 @@ class Foo
}
---

There's a problem if $(TT Foo.bar()) exits via an exception - the verbose
There's a problem if $(D Foo.bar()) exits via an exception - the verbose
flag state is not restored.
That's easily fixed with $(D_KEYWORD scope)(exit):

Expand All @@ -291,7 +291,7 @@ class Foo
}
---

$(P It also neatly solves the problem if $(TT ...lots of code...) goes on at
$(P It also neatly solves the problem if $(D ...lots of code...) goes on at
some length, and in the future a maintenance programmer inserts a
return statement in it, not realizing that verbose must be reset upon
exit. The reset code is where it belongs conceptually, rather than where
Expand All @@ -316,33 +316,33 @@ Sending an email consists of two operations:

$(OL
$(LI Perform the SMTP send operation.)
$(LI Copy the email to the $(DOUBLEQUOTE Sent) folder, which in POP is on the local
$(LI Copy the email to the $(DOUBLEQUOTE Sent) folder, which in POP is on the local
disk, and in IMAP is also remote.)
)

$(P Messages should not appear in $(DOUBLEQUOTE Sent) that haven't been actually sent,
and sent messages must actually appear in $(DOUBLEQUOTE Sent).
)

$(P Operation (1) is not undoable because it's a well-known distributed
computing issue. Operation (2) is undoable with some degree of
$(P Operation (1) is not undoable because it's a well-known distributed
computing issue. Operation (2) is undoable with some degree of
reliability. So we break the job down into three steps:
)

$(OL
$(LI Copy the message to $(DOUBLEQUOTE Sent) with a changed title $(DOUBLEQUOTE [Sending]
&lt;Subject&gt;). This operation ensures there's space in the client's IMAP
account (or on the local disk), the rights are proper, the connection
$(LI Copy the message to $(DOUBLEQUOTE Sent) with a changed title $(DOUBLEQUOTE [Sending]
&lt;Subject&gt;). This operation ensures there's space in the client's IMAP
account (or on the local disk), the rights are proper, the connection
exists and works, etc.)

$(LI Send the message via SMTP.)

$(LI If sending fails, delete the message from $(DOUBLEQUOTE Sent). If the message
$(LI If sending fails, delete the message from $(DOUBLEQUOTE Sent). If the message
succeeds,
change its title from $(DOUBLEQUOTE [Sending] &lt;Subject&gt;) to $(DOUBLEQUOTE &lt;Subject&gt;).
Both of these operation have a high probability to succeed. If the
folder is local, the probability of success is very high. If the folder
is remote, probability is still vastly higher than that of step (1)
change its title from $(DOUBLEQUOTE [Sending] &lt;Subject&gt;) to $(DOUBLEQUOTE &lt;Subject&gt;).
Both of these operation have a high probability to succeed. If the
folder is local, the probability of success is very high. If the folder
is remote, probability is still vastly higher than that of step (1)
because it doesn't involve an arbitrarily large data transfer.)

)
Expand All @@ -366,18 +366,18 @@ class Mailer
---

This is a compelling solution to a complex problem.
Rewriting it with RAII would require two extra silly classes,
Rewriting it with RAII would require two extra silly classes,
MessageTitleSaver and MessageRemover.
Rewriting the example with try-finally would require nested try-finally
statements or use of an extra variable to track state evolution.

<h3>Example</h3>

Consider giving feedback to the user about a lengthy
operation (mouse changes to an hourglass, window title is
Consider giving feedback to the user about a lengthy
operation (mouse changes to an hourglass, window title is
red/italicized, ...).
With $(D_KEYWORD scope)(exit) that can be easily done without
needing to make an artificial resource out of whatever UI state element
With $(D_KEYWORD scope)(exit) that can be easily done without
needing to make an artificial resource out of whatever UI state element
used for the cues:

--------------
Expand Down Expand Up @@ -405,8 +405,8 @@ void LongFunction()

<h2>When to use RAII, try-catch-finally, and Scope</h2>

RAII is for managing resources, which is different from managing state
or transactions. try-catch is still needed, as scope doesn't catch
RAII is for managing resources, which is different from managing state
or transactions. try-catch is still needed, as scope doesn't catch
exceptions. It's try-finally that becomes redundant.

<h2>Acknowledgements</h2>
Expand Down
44 changes: 22 additions & 22 deletions expression.dd
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,10 @@ x.re == y.re && x.im == y.im
x.re != y.re || x.im != y.im
---

$(P For class and struct objects, the expression $(TT (a == b))
$(P For class and struct objects, the expression $(D (a == b))
is rewritten as
$(TT a.opEquals(b)), and $(TT (a != b)) is rewritten as
$(TT !a.opEquals(b)).
$(D a.opEquals(b)), and $(D (a != b)) is rewritten as
$(D !a.opEquals(b)).
)

$(P For class objects, the $(CODE ==) and $(CODE !=)
Expand Down Expand Up @@ -345,7 +345,7 @@ $(GNAME IdentityExpression):
)

$(P The $(B is) compares for identity.
To compare for not identity, use $(TT $(I e1) $(B !is) $(I e2)).
To compare for not identity, use $(D $(I e1) $(B !is) $(I e2)).
The type of the result is bool. The operands
go through the usual conversions to bring them to a common type before
comparison.
Expand Down Expand Up @@ -870,8 +870,8 @@ void test(A a, B b) {
}
-------------

$(P In order to determine if an object $(TT o) is an instance of
a class $(TT B) use a cast:
$(P In order to determine if an object $(D o) is an instance of
a class $(D B) use a cast:
)

-------------
Expand Down Expand Up @@ -1100,7 +1100,7 @@ void main() {
cast to $(B this)'s base class.
It is an error if there is no base class.
It is an error to use $(B super) within a struct member function.
(Only class $(TT Object) has no base class.)
(Only class $(D Object) has no base class.)
If a member function is called with an explicit reference
to $(B super), a non-virtual call is made.
)
Expand Down Expand Up @@ -1148,22 +1148,22 @@ $(GNAME StringLiterals):

$(V1
$(TABLE1
$(TROW $(TT char*))
$(TROW $(TT wchar*))
$(TROW $(TT dchar*))
$(TROW $(TT char[]))
$(TROW $(TT wchar[]))
$(TROW $(TT dchar[]))
$(TROW $(D char*))
$(TROW $(D wchar*))
$(TROW $(D dchar*))
$(TROW $(D char[]))
$(TROW $(D wchar[]))
$(TROW $(D dchar[]))
)
)
$(V2
$(TABLE1
$(TROW $(TT immutable(char)*))
$(TROW $(TT immutable(wchar)*))
$(TROW $(TT immutable(dchar)*))
$(TROW $(TT immutable(char)[]))
$(TROW $(TT immutable(wchar)[]))
$(TROW $(TT immutable(dchar)[]))
$(TROW $(D immutable(char)*))
$(TROW $(D immutable(wchar)*))
$(TROW $(D immutable(dchar)*))
$(TROW $(D immutable(char)[]))
$(TROW $(D immutable(wchar)[]))
$(TROW $(D immutable(dchar)[]))
)
)
$(P String literals have a 0 appended to them, which makes
Expand Down Expand Up @@ -1407,13 +1407,13 @@ $(GNAME AssertExpression):
It is an error if the $(I expression) contains any side effects
that the program depends on. The compiler may optionally not
evaluate assert expressions at all.
The result type of an assert expression is $(TT void).
The result type of an assert expression is $(D void).
Asserts are a fundamental part of the
$(LINK2 $(WEB dbc.html)$(EBOOK #Contract Programming), Contract Programming)
support in D.
)

$(P The expression $(TT assert(0)) is a special case; it
$(P The expression $(D assert(0)) is a special case; it
signifies that it is unreachable code.
Either $(B AssertError) is thrown at runtime if it is reachable,
or the execution is halted
Expand All @@ -1424,7 +1424,7 @@ $(GNAME AssertExpression):
)

$(P The second $(I Expression), if present, must be implicitly
convertible to type $(V1 $(TT char[]))$(V2 $(TT const(char)[])).
convertible to type $(V1 $(D char[]))$(V2 $(D const(char)[])).
It is evaluated if the
result is false, and the string result is appended to the
$(B AssertError)'s message.
Expand Down
16 changes: 8 additions & 8 deletions faq.dd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $(D_S $(TITLE),

$(LI Where is my simple language?)

$(LI $(LINK2 cpp0x.html, What's D 2.0's answer to C++0x's proposed new features?))
$(REDO $(LI $(LINK2 cpp0x.html, What's D 2.0's answer to C++0x's proposed new features?)))

$(LI What other cool features are in the plans for D 2.0?)

Expand All @@ -34,7 +34,7 @@ $(D_S $(TITLE),
$(LI I want to contribute to D 2.0. How can I effect that?)

$(ITEMR case_range, Why doesn't the case range statement
use the $(TT case X..Y:) syntax?)
use the $(D case X..Y:) syntax?)

$(ITEMR shared_guarantees, What guarantees is shared supposed to provide?)

Expand Down Expand Up @@ -90,15 +90,15 @@ $(D_S $(TITLE),
)

$(ITEM case_range, Why doesn't the case range statement
use the $(TT case X..Y:) syntax?)
use the $(D case X..Y:) syntax?)

$(P See the $(LINK2 statement.html#CaseRangeStatement, case range statement).)

$(P The usages of .. would then be:
$(OL
$(LI $(TT case X..Y:))
$(LI $(TT foreach(e; X..Y)))
$(LI $(TT array[X..Y]))
$(LI $(D case X..Y:))
$(LI $(D foreach(e; X..Y)))
$(LI $(D array[X..Y]))
)
Case (1) has a VERY DIFFERENT meaning from (2) and (3).
(1) is inclusive of Y, and (2) and (3) are exclusive of Y.
Expand Down Expand Up @@ -492,14 +492,14 @@ $(ITEM omf, Can I link in C object files created with another compiler?)
tool.

$(ITEM regexp_literals, Why not support regular expression literals
with the $(TT /foo/g) syntax?)
with the $(D /foo/g) syntax?)

$(P There are two reasons:
)

$(OL

$(LI The $(TT /foo/g) syntax would make it impossible to separate
$(LI The $(D /foo/g) syntax would make it impossible to separate
the lexer from the parser, as / is the divide token.)

$(LI There are already 3 string types; adding the regex literals
Expand Down
6 changes: 3 additions & 3 deletions features2.dd
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ $(UL
$(LI Transformed all of $(CODE string), $(CODE wstring),
and $(CODE dstring) into immutable definitions).
$(LI Added $(LINK2 function.html#overload-sets, Overload Sets) for functions and templates.)
$(LI $(TT std.math.sin), $(TT cos), $(TT tan) are now evaluated at
compile time if the argument is a constant.)
$(LI $(D std.math.sin), $(D cos), $(D tan) are now evaluated at
compile time if the argument is a constant.)
$(LI Added $(LINK2 cpp_interface.html, C++ interface) for $(SINGLEQUOTE plugins).)
$(LI Changed result type of
$(LINK2 expression.html#IsExpression, $(I IsExpression))
Expand Down Expand Up @@ -91,7 +91,7 @@ $(UL
$(LI $(LINK2 phobos/std_variant.html, std.variant): new module.)

$(LI Incorporated many of the Tango GC structural differences (much more to go still).)
$(LI Overhaul phobos $(TT linux.mak) and add documentation build logic)
$(LI Overhaul phobos $(D linux.mak) and add documentation build logic)
$(LI Moved $(B next) member from $(B Object.Error) to $(B Object.Exception))
$(LI Renamed linux library from $(B libphobos.a) to $(B libphobos2.a))

Expand Down
588 changes: 0 additions & 588 deletions final-const-invariant.dd

This file was deleted.

22 changes: 11 additions & 11 deletions function.dd
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ void foo() {
overridden.
)

$(P Functions marked as $(TT final) may not be overridden in a
derived class, unless they are also $(TT private).
$(P Functions marked as $(D final) may not be overridden in a
derived class, unless they are also $(D private).
For example:
)

Expand Down Expand Up @@ -749,7 +749,7 @@ $(CONSOLE
2
)

$(P A lazy parameter of type $(TT void) can accept an argument
$(P A lazy parameter of type $(D void) can accept an argument
of any type.)

<h3>Function Default Arguments</h3>
Expand Down Expand Up @@ -787,7 +787,7 @@ foo(4); // same as foo(4, 3);

A C-style variadic function is declared as taking
a parameter of ... after the required function parameters.
It has non-D linkage, such as $(TT extern (C)):
It has non-D linkage, such as $(D extern (C)):

------
extern (C) int foo(int x, int y, ...);
Expand All @@ -805,10 +805,10 @@ extern (C) int def(...); // error, must have at least one parameter

C-style variadic functions match the C calling convention for
variadic functions, and is most useful for calling C library
functions like $(TT printf).
functions like $(D printf).
The implementiations of these variadic functions have a special
local variable declared for them,
$(B _argptr), which is a $(TT void*) pointer to the first of the
$(B _argptr), which is a $(D void*) pointer to the first of the
variadic
arguments. To access the arguments, $(B _argptr) must be cast
to a pointer to the expected argument type:
Expand Down Expand Up @@ -845,7 +845,7 @@ int def(...); // ok

These variadic functions have a special local variable declared for
them,
$(B _argptr), which is a $(TT void*) pointer to the first of the
$(B _argptr), which is a $(D void*) pointer to the first of the
variadic
arguments. To access the arguments, $(B _argptr) must be cast
to a pointer to the expected argument type:
Expand All @@ -861,7 +861,7 @@ int foo(int x, int y, ...) {
------

An additional hidden argument
with the name $(B _arguments) and type $(TT TypeInfo[])
with the name $(B _arguments) and type $(D TypeInfo[])
is passed to the function.
$(B _arguments) gives the number of arguments and the type
of each, enabling the creation of typesafe variadic functions.
Expand Down Expand Up @@ -1453,7 +1453,7 @@ void test() {
)

$(P The $(B .ptr) property of a delegate will return the
$(I frame pointer) value as a $(TT void*).
$(I frame pointer) value as a $(D void*).
)

$(P The $(B .funcptr) property of a delegate will return the
Expand All @@ -1471,11 +1471,11 @@ void test() {

<h2>main() Function</h2>

$(P For console programs, $(TT main()) serves as the entry point.
$(P For console programs, $(D main()) serves as the entry point.
It gets called after all the module initializers are run, and
after any unittests are run.
After it returns, all the module destructors are run.
$(TT main()) must be declared using one of the following forms:
$(D main()) must be declared using one of the following forms:
)

----
Expand Down
12 changes: 6 additions & 6 deletions garbage.dd
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ $(SPEC_S Garbage Collection,
collection shows that:
)

$(UL
$(UL

$(LI Garbage collected programs are faster. This is counterintuitive,
but the reasons are:

$(UL
$(UL
$(LI Reference counting is a common solution to solve explicit
memory allocation problems. The code to implement the increment and
decrement operations whenever assignments are made is one source
Expand Down Expand Up @@ -97,7 +97,7 @@ $(SPEC_S Garbage Collection,
$(P Garbage collection is not a panacea. There are some downsides:
)

$(UL
$(UL

$(LI It is not predictable when a collection gets run, so the program
can arbitrarily pause.
Expand Down Expand Up @@ -234,7 +234,7 @@ p = cast(void*)12345678; // error: undefined behavior
A copying garbage collector may change this value.
)

$(LI Do not store magic values into pointers, other than $(TT null).
$(LI Do not store magic values into pointers, other than $(D null).
)

$(LI Do not write pointer values out to disk and read them back in
Expand Down Expand Up @@ -288,11 +288,11 @@ align (1) struct Foo {
This may result in intermediate conditions where there is
not a valid pointer, and if the gc pauses the thread in such a
condition, it can corrupt memory.
Most implementations of $(TT memcpy()) will work since the
Most implementations of $(D memcpy()) will work since the
internal implementation of it does the copy in aligned chunks
greater than or equal to a pointer size, but since this kind of
implementation is not guaranteed by the C standard, use
$(TT memcpy()) only with extreme caution.
$(D memcpy()) only with extreme caution.
)

$(LI Do not have pointers in a struct instance that point back
Expand Down
16 changes: 8 additions & 8 deletions glossary.dd
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ void test()
S s = *foo(&tmp);
}
---
$(P This rewrite gives us an extra temporary object $(TT tmp),
$(P This rewrite gives us an extra temporary object $(D 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:
What NRVO does is recognize that the sole purpose of $(D result)
is to provide a return value, and so all references to $(D result)
can be replaced with $(D *hidden).
$(D foo) is then rewritten as:
)
---
S* foo(S* hidden)
Expand All @@ -131,7 +131,7 @@ S* foo(S* hidden)
return hidden;
}
---
$(P A further optimization is done on the call to $(TT foo) to eliminate
$(P A further optimization is done on the call to $(D foo) to eliminate
the other copy, giving:)
---
void test()
Expand All @@ -140,7 +140,7 @@ void test()
foo(&s);
}
---
$(P The result is written directly into the destination $(TT s),
$(P The result is written directly into the destination $(D s),
instead of passing through two other instances.)
)

Expand Down Expand Up @@ -186,7 +186,7 @@ void test()
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.
RAII objects in D are created using the $(D scope) storage class.
)

$(DT $(LNAME2 sequential_consistency, Sequential Consistency))
Expand Down
26 changes: 13 additions & 13 deletions hash-map.dd
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ if (p !is (B null))

$(P Classes can be used as the $(I KeyType). For this to work,
the class definition must override the following member functions
of class $(TT Object):)
of class $(D Object):)

$(UL
$(LI $(TT hash_t toHash()))
$(V1 $(LI $(TT int opEquals(Object))))
$(V2 $(LI $(TT bool opEquals(Object))))
$(LI $(TT int opCmp(Object)))
$(LI $(D hash_t toHash()))
$(V1 $(LI $(D int opEquals(Object))))
$(V2 $(LI $(D bool opEquals(Object))))
$(LI $(D int opCmp(Object)))
)

$(P $(TT hash_t) is an alias to an integral type.)
$(P $(D hash_t) is an alias to an integral type.)

$(P Note that the parameter to $(TT opCmp) and $(TT opEquals) is
$(P Note that the parameter to $(D opCmp) and $(D opEquals) is
of type
$(TT Object), not the type of the class in which it is defined.)
$(D Object), not the type of the class in which it is defined.)

$(P For example:)

Expand All @@ -86,9 +86,9 @@ $(V1 int $(B opEquals)(Object o))$(V2 bool $(B opEquals)(Object o))
}
---

$(P The implementation may use either $(TT opEquals) or $(TT opCmp) or
$(P The implementation may use either $(D opEquals) or $(D opCmp) or
both. Care should be taken so that the results of
$(TT opEquals) and $(TT opCmp) are consistent with each other when
$(D opEquals) and $(D opCmp) are consistent with each other when
the class objects are the same or not.)

<h3>Using Structs or Unions as the KeyType</h3>
Expand Down Expand Up @@ -162,9 +162,9 @@ struct MyString {
)


$(P The implementation may use either $(TT opEquals) or $(TT opCmp) or
$(P The implementation may use either $(D opEquals) or $(D opCmp) or
both. Care should be taken so that the results of
$(TT opEquals) and $(TT opCmp) are consistent with each other when
$(D opEquals) and $(D opCmp) are consistent with each other when
the struct/union objects are the same or not.)

<h3>Properties</h3>
Expand Down Expand Up @@ -289,7 +289,7 @@ void main (string[] args) {
inWord = false;
}
++charCount;

// Let's consider the file has LF EOL.
if (c == '\n')
++lineCount;
Expand Down
8 changes: 4 additions & 4 deletions htod.dd
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ $(DD Indicates a C++ header file

$(DT $(B -hc)
$(DD By default, $(B htod) will insert the C and C++ declarations
in a file into the output file prefixed by $(TT //C ).
in a file into the output file prefixed by $(D //C ).
$(B -hc) will suppress this.
Use only if you're confident that $(B htod) is generating the
correct output file (such as if the header file was modified with
Expand All @@ -60,13 +60,13 @@ $(B __HTOD__)).
)

$(DT $(B -hi)
$(DD By default, $(B htod) will represent a $(TT #include "file") with
$(DD By default, $(B htod) will represent a $(D #include "file") with
a corresponding $(B import) statement. The $(B -hi) will cause the
declarations in the included file to be converted to D declarations as
well. The declarations in all included files are parsed regardless.
$(B -hi) is handy when replacing an entire hierarchy of include files
with a single D import.
System includes like $(TT #include &lt;file&gt;) are not affected
System includes like $(D #include &lt;file&gt;) are not affected
by $(B -hi).
See also $(B -hs).
)
Expand Down Expand Up @@ -124,7 +124,7 @@ alias int MYINT;
void bar(int x, int y, long z);
---

$(P The C declarations are prefixed by the string $(TT "//C ").)
$(P The C declarations are prefixed by the string $(D "//C ").)

<h3>Type Mappings</h3>

Expand Down
46 changes: 23 additions & 23 deletions htomodule.dd
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Ddoc

$(D_S Converting C $(TT .h) Files to D Modules,
$(D_S Converting C $(D .h) Files to D Modules,

While D cannot directly compile C source code, it can easily
interface to C code, be linked with C object files, and call
C functions in DLLs.
The interface to C code is normally found in C $(TT .h) files.
The interface to C code is normally found in C $(D .h) files.
So, the trick to connecting with C code is in converting C
$(TT .h) files to D modules.
$(D .h) files to D modules.
This turns out to be difficult to do mechanically since
inevitably some human judgement must be applied.
This is a guide to doing such conversions.

<h4>Preprocessor</h4>

$(TT .h) files can sometimes be a bewildering morass of layers of
macros, $(TT #include) files, $(TT #ifdef)'s, etc. D doesn't
$(D .h) files can sometimes be a bewildering morass of layers of
macros, $(D #include) files, $(D #ifdef)'s, etc. D doesn't
include a text preprocessor like the C preprocessor,
so the first step is to remove the need for
it by taking the preprocessed output. For DMC (the Digital
Expand All @@ -25,11 +25,11 @@ $(CONSOLE
<a href="http://www.digitalmars.com/ctg/sc.html">dmc</a> <a href="http://www.digitalmars.com/ctg/sc.html#dashc">-c</a> program.h <a href="http://www.digitalmars.com/ctg/sc.html#dashe">-e</a> <a href="http://www.digitalmars.com/ctg/sc.html#dashl">-l</a>
)

will create a file $(TT program.lst) which is the source file after
will create a file $(D program.lst) which is the source file after
all text preprocessing.
<p>

Remove all the $(TT #if), $(TT #ifdef), $(TT #include),
Remove all the $(D #if), $(D #ifdef), $(D #include),
etc. statements.

<h4>Linkage</h4>
Expand Down Expand Up @@ -100,13 +100,13 @@ extern (C)

<h4>NULL</h4>

$(TT NULL) and $(TT ((void*)0)) should be replaced
with $(TT null).
$(D NULL) and $(D ((void*)0)) should be replaced
with $(D null).

<h4>Numeric Literals</h4>

Any $(SINGLEQUOTE L) or $(SINGLEQUOTE l) numeric literal suffixes should be removed,
as a C $(TT long) is (usually) the same size as a D $(TT int).
as a C $(D long) is (usually) the same size as a D $(D int).
Similarly, $(SINGLEQUOTE LL) suffixes should be replaced with a
single $(SINGLEQUOTE L).
Any $(SINGLEQUOTE u) suffix will work the same in D.
Expand Down Expand Up @@ -248,8 +248,8 @@ $(V1

<h4>Const Type Modifiers</h4>

D has $(TT const) as a storage class, not a type modifier. Hence, just
drop any $(TT const) used as a type modifier:
D has $(D const) as a storage class, not a type modifier. Hence, just
drop any $(D const) used as a type modifier:

$(CCODE
void foo(const int *p, char *const q);
Expand All @@ -268,14 +268,14 @@ void foo(int* p, char* q);
there will be a multiple definition error. To fix this problem,
use the extern storage class.
For example, given a C header file named
$(TT foo.h):
$(D foo.h):

$(CCODE
struct Foo { };
struct Foo bar;
)

It can be replaced with the D modules, $(TT foo.d):
It can be replaced with the D modules, $(D foo.d):

---------------------------
struct Foo { }
Expand All @@ -288,7 +288,7 @@ extern (C)

<h4>Typedef</h4>

$(TT alias) is the D equivalent to the C $(TT typedef):
$(D alias) is the D equivalent to the C $(D typedef):

$(CCODE
typedef int foo;
Expand Down Expand Up @@ -325,8 +325,8 @@ alias Foo* pFoo, lpFoo;

A good D implementation by default will align struct members the
same way as the C compiler it was designed to work with. But
if the $(TT .h) file has some $(TT #pragma)'s to control alignment, they
can be duplicated with the D $(TT align) attribute:
if the $(D .h) file has some $(D #pragma)'s to control alignment, they
can be duplicated with the D $(D align) attribute:

$(CCODE
#pragma pack(1)
Expand Down Expand Up @@ -394,7 +394,7 @@ struct Abc
}
---------------------------

<h4>$(TT __cdecl), $(TT __pascal), $(TT __stdcall)</h4>
<h4>$(D __cdecl), $(D __pascal), $(D __stdcall)</h4>

$(CCODE
int __cdecl x;
Expand All @@ -412,7 +412,7 @@ extern (Pascal) int bar(int b);
extern (Windows) int abc(int c);
---------------------------

<h4>$(TT __declspec(dllimport))</h4>
<h4>$(D __declspec(dllimport))</h4>

$(CCODE
__declspec(dllimport) int __stdcall foo(int a);
Expand All @@ -424,9 +424,9 @@ __declspec(dllimport) int __stdcall foo(int a);
export extern (Windows) int foo(int a);
---------------------------

<h4>$(TT __fastcall)</h4>
<h4>$(D __fastcall)</h4>

Unfortunately, D doesn't support the $(TT __fastcall) convention.
Unfortunately, D doesn't support the $(D __fastcall) convention.
Therefore, a shim will be needed, either written in C:

$(CCODE
Expand All @@ -438,10 +438,10 @@ int myfoo(int a)
}
)

and compiled with a C compiler that supports $(TT __fastcall) and
and compiled with a C compiler that supports $(D __fastcall) and
linked in, or compile the above, disassemble it with
<a href="http://www.digitalmars.com/ctg/obj2asm.html">obj2asm</a>
and insert it in a D $(TT myfoo) shim with
and insert it in a D $(D myfoo) shim with
<a href="iasm.html">inline assembler</a>.

)
Expand Down
14 changes: 7 additions & 7 deletions interface.dd
Original file line number Diff line number Diff line change
Expand Up @@ -234,21 +234,21 @@ $(SECTION2 $(LNAME2 COM-Interfaces, COM Interfaces),
)

$(P A COM interface is defined as one that derives from the interface
$(TT std.c.windows.com.IUnknown). A COM interface differs from
$(D std.c.windows.com.IUnknown). A COM interface differs from
a regular D interface in that:
)

$(UL
$(LI It derives from the interface $(TT std.c.windows.com.IUnknown).)
$(LI It derives from the interface $(D std.c.windows.com.IUnknown).)
$(LI It cannot be the argument of a $(I DeleteExpression).)
$(LI References cannot be upcast to the enclosing class object, nor
can they be downcast to a derived interface. To accomplish this,
an appropriate $(TT QueryInterface()) would have to be implemented
an appropriate $(D QueryInterface()) would have to be implemented
for that interface in standard COM fashion.)
$(LI Classes derived from COM interfaces are COM classes.)
$(LI The default linkage for member functions of COM classes
is $(TT extern(System)).)
$(LI The first member of the $(TT vtbl[]) is not the pointer
is $(D extern(System)).)
$(LI The first member of the $(D vtbl[]) is not the pointer
to the InterfaceInfo, but the first virtual function pointer.)
)
)
Expand Down Expand Up @@ -288,8 +288,8 @@ class Ifoo
can they be downcast to a derived interface.)
$(LI The C++ calling convention is the default convention
for its member functions, rather than the D calling convention.)
$(LI The first member of the $(TT vtbl[]) is not the pointer
to the $(TT Interface), but the first virtual function pointer.)
$(LI The first member of the $(D vtbl[]) is not the pointer
to the $(D Interface), but the first virtual function pointer.)
)
)
)
Expand Down
8 changes: 4 additions & 4 deletions interfaceToC.dd
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ int myDfunction(char[] s) {

$(P There are several things going on here:)

$(UL
$(UL
$(LI D understands how C function names are "mangled" and the
correct C function call/return sequence.)

Expand All @@ -48,7 +48,7 @@ int myDfunction(char[] s) {

$(LI There are no __cdecl, __far, __stdcall, __declspec, or other
such C type modifiers in D. These are handled by attributes, such
as $(TT extern (C)).)
as $(D extern (C)).)

$(LI There are no const or volatile type modifiers in D. To declare
a C function that uses those type modifiers, just drop those
Expand Down Expand Up @@ -91,7 +91,7 @@ extern (C) {
done with it. This is accomplished by:
)

$(UL
$(UL

$(LI Making a copy of the data using std.c.stdlib.malloc() and passing
the copy instead.)
Expand Down Expand Up @@ -355,7 +355,7 @@ extern (C)
Although printf is designed to handle 0 terminated strings,
not D dynamic arrays of chars, it turns out that since D
dynamic arrays are a length followed by a pointer to the data,
the $(TT %.*s) format works:
the $(D %.*s) format works:
)

------
Expand Down
12 changes: 6 additions & 6 deletions lazy-evaluation.dd
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ void test(int* p)
}
---

$(P The second expression $(TT p[0]) is not evaluated unless $(TT p)
$(P The second expression $(D p[0]) is not evaluated unless $(D p)
is not $(B null).
If the second expression was not lazily evaluated, it would
generate a runtime fault if $(TT p) was $(B null).
generate a runtime fault if $(D p) was $(B null).
)

$(P While invaluable, the lazy evaluation operators have significant
Expand Down Expand Up @@ -80,7 +80,7 @@ $(P but that just papers over the problem. Preprocessor macros have
well known shortcomings:)

$(UL
$(LI The $(TT logging) variable is exposed in the user's namespace.)
$(LI The $(D logging) variable is exposed in the user's namespace.)
$(LI Macros are invisible to symbolic debuggers.)
$(LI Macros are global only, and cannot be scoped.)
$(LI Macros cannot be class members.)
Expand Down Expand Up @@ -108,15 +108,15 @@ void foo(int i)

$(P Now, the string building expression only gets evaluated if logging
is true, and encapsulation is maintained. The only trouble is that
few are going to want to wrap expressions with $(TT { return $(I exp); }).
few are going to want to wrap expressions with $(D { return $(I exp); }).
)

$(P So D takes it one small, but crucial, step further
(suggested by Andrei Alexandrescu).
Any expression
can be implicitly converted to a delegate that returns either $(TT void) or
can be implicitly converted to a delegate that returns either $(D void) or
the type of the expression.
The delegate declaration is replaced by the $(TT lazy) storage class
The delegate declaration is replaced by the $(D lazy) storage class
(suggested by Tomasz Stachowiak).
The functions then become:
)
Expand Down
6 changes: 3 additions & 3 deletions lex.dd
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ a = /+ /* +/ */ 3; // parses as if 'a = */ 3;'
-------------

Comments cannot be used as token concatenators, for example,
<code>abc/**/def</code> is two tokens, $(TT abc) and $(TT def),
not one $(TT abcdef) token.
<code>abc/**/def</code> is two tokens, $(D abc) and $(D def),
not one $(D abcdef) token.

<h3>Tokens</h3>

Expand Down Expand Up @@ -1058,7 +1058,7 @@ $(GNAME Filespec):
parsing.
)

$(P There is currently only one special token sequence, $(TT #line).
$(P There is currently only one special token sequence, $(D #line).
)

$(P This sets the source line number to $(GLINK Integer),
Expand Down
73 changes: 35 additions & 38 deletions linux.mak
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,47 @@ STYLES=css/style.css css/print.css
PREMADE=dcompiler.html language-reference.html appendices.html \
howtos.html articles.html

TARGETS=cpptod.html ctod.html download.html pretod.html \
cppstrings.html cppdbc.html gsoc2011.html index.html \
overview.html spec.html intro.html lex.html module.html \
dnews.html declaration.html type.html property.html \
attribute.html pragma.html expression.html statement.html \
arrays.html struct.html class.html enum.html function.html \
operatoroverloading.html template.html mixin.html dbc.html \
version.html errors.html garbage.html memory.html float.html \
iasm.html interface.html portability.html html.html entity.html \
abi.html windows.html dll.html htomodule.html faq.html \
dstyle.html wc.html future.html changelog.html glossary.html \
acknowledgements.html builtin.html interfaceToC.html \
comparison.html rationale.html ddoc.html code_coverage.html \
exception-safe.html rdmd.html templates-revisited.html \
warnings.html ascii-table.html windbg.html htod.html \
regular-expression.html lazy-evaluation.html lisp-java-d.html \
variadic-function-templates.html howto-promote.html tuple.html \
template-comparison.html template-mixin.html \
final-const-invariant.html const.html traits.html COM.html \
cpp_interface.html hijack.html const3.html features2.html \
safed.html cpp0x.html const-faq.html dmd-windows.html \
dmd-linux.html dmd-osx.html dmd-freebsd.html concepts.html \
memory-safe-d.html d-floating-point.html migrate-to-shared.html \
D1toD2.html unittest.html hash-map.html pdf-intro-cover.html \
pdf-spec-cover.html pdf-tools-cover.html intro-to-datetime.html \
TARGETS=32-64-portability.html cpptod.html ctod.html download.html \
pretod.html gsoc2011.html index.html overview.html spec.html \
intro.html lex.html module.html declaration.html type.html \
property.html attribute.html pragma.html expression.html \
statement.html arrays.html struct.html class.html enum.html \
function.html operatoroverloading.html template.html mixin.html \
dbc.html version.html errors.html garbage.html memory.html \
float.html iasm.html interface.html portability.html entity.html \
abi.html windows.html dll.html htomodule.html faq.html \
dstyle.html wc.html changelog.html glossary.html \
acknowledgements.html builtin.html interfaceToC.html \
comparison.html rationale.html ddoc.html code_coverage.html \
exception-safe.html rdmd.html templates-revisited.html \
warnings.html ascii-table.html windbg.html htod.html \
regular-expression.html lazy-evaluation.html \
variadic-function-templates.html howto-promote.html tuple.html \
template-comparison.html template-mixin.html traits.html COM.html \
cpp_interface.html hijack.html const3.html features2.html \
safed.html const-faq.html dmd-windows.html dmd-linux.html \
dmd-osx.html dmd-freebsd.html concepts.html memory-safe-d.html \
d-floating-point.html migrate-to-shared.html D1toD2.html \
unittest.html hash-map.html pdf-intro-cover.html \
pdf-spec-cover.html pdf-tools-cover.html intro-to-datetime.html \
std_consolidated_header.html

PDFINTRO=index.html overview.html wc.html warnings.html builtin.html \
ctod.html cpptod.html pretod.html template-comparison.html \
cppstrings.html cppdbc.html lisp-java-d.html cpp0x.html
ctod.html cpptod.html pretod.html template-comparison.html

PDFFEATURES=comparison.html features2.html

PDFFAQ=faq.html const-faq.html rationale.html future.html
PDFFAQ=faq.html const-faq.html rationale.html

PDFSPEC=spec.html intro.html \
lex.html module.html declaration.html type.html property.html \
attribute.html pragma.html expression.html statement.html \
arrays.html hash-map.html struct.html class.html interface.html \
enum.html const3.html function.html operatoroverloading.html \
template.html template-mixin.html dbc.html version.html \
traits.html errors.html unittest.html garbage.html float.html \
iasm.html ddoc.html interfaceToC.html cpp_interface.html \
portability.html html.html entity.html memory-safe-d.html abi.html
PDFSPEC=spec.html intro.html lex.html module.html declaration.html \
type.html property.html attribute.html pragma.html \
expression.html statement.html arrays.html hash-map.html \
struct.html class.html interface.html enum.html const3.html \
function.html operatoroverloading.html template.html \
template-mixin.html dbc.html version.html traits.html errors.html \
unittest.html garbage.html float.html iasm.html ddoc.html \
interfaceToC.html cpp_interface.html portability.html entity.html \
memory-safe-d.html abi.html

PDFHOWTOS=windows.html dll.html COM.html htomodule.html

Expand Down Expand Up @@ -115,7 +112,7 @@ html : $(ALL_FILES)
$(DOC_OUTPUT_DIR)/sitemap.html : $(ALL_FILES_BUT_SITEMAP)
cp -f sitemap-template.dd sitemap.dd
true $(foreach F, $(sort $(TARGETS) $(IMAGES)), \
&& echo "<a href=$F>`sed -n 's/<title>\(.*\)<\/title>/\1/'p $(DOC_OUTPUT_DIR)/$F`" \
&& echo "<a href=$F>`sed -n 's/<title>\(.*\) - D Programming Language.*<\/title>/\1/'p $(DOC_OUTPUT_DIR)/$F`" \
"</a><p>" >> sitemap.dd)
$(DMD) -c -o- -Df$@ $(DDOC) sitemap.dd
rm -rf sitemap.dd
Expand Down
215 changes: 0 additions & 215 deletions lisp-java-d.dd

This file was deleted.

6 changes: 3 additions & 3 deletions memory.dd
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void test()
to run. For specialized purposes, this can be handled by
creating $(I NewDeclaration)s and $(I DeleteDeclaration)s.
For example, to allocate using the C runtime library's
$(TT malloc) and $(TT free):
$(D malloc) and $(D free):
)

------
Expand Down Expand Up @@ -521,7 +521,7 @@ void foo()
$(P Therefore, the ISR thread should not be paused.
Threads created with the $(LINK2 phobos/core_thread.html, core.thread)
functions will be paused. But threads created with C's
$(TT _beginthread()) or equivalent won't be, the GC
$(D _beginthread()) or equivalent won't be, the GC
won't know they exist.
)

Expand All @@ -530,7 +530,7 @@ void foo()
$(UL

$(LI The ISR thread cannot allocate any memory using the GC.
This means that the global $(TT new) cannot be used.
This means that the global $(D new) cannot be used.
Nor can dynamic arrays be resized, nor can any elements be
added to associative arrays. Any use of the D runtime library
should be examined for any possibility of allocating GC memory -
Expand Down
65 changes: 32 additions & 33 deletions overview.dd
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@ $(SECTION2 Why D?,
to write fully portable C++ code.
)

$(P C++ implements things like resizable arrays and string concatenation
as part of the standard library, not as part of the core language.
Not being part of the core language has several
$(LINK2 cppstrings.html, suboptimal consequences).
)
$(P C++ implements things like resizable arrays and string
concatenation as part of the standard library, not as part of the
core language. $(REDO Not being part of the core language has
several $(LINK2 cppstrings.html, suboptimal consequences).))

$(P Can the power and capability of C++ be extracted, redesigned,
and recast into a language that is simple, orthogonal,
Expand All @@ -76,9 +75,9 @@ $(SECTION2 Why D?,

$(P Modern compiler technology has progressed to the point where language
features for the purpose of compensating for primitive compiler
technology can be omitted. (An
technology can be omitted. (An
example of this would be the $(SINGLEQUOTE register) keyword in C, a more
subtle example is the macro
subtle example is the macro
preprocessor in C.)
We can rely on modern compiler optimization technology to not
need language features necessary to get acceptable code quality out of
Expand Down Expand Up @@ -146,7 +145,7 @@ $(SECTION3 Features To Keep,

$(P The general look of D is like C and C++. This makes it easier to learn
and port code to D. Transitioning from C/C++ to D should feel natural.
The
The
programmer will not have to learn an entirely new way of doing things.
)

Expand Down Expand Up @@ -176,24 +175,24 @@ $(SECTION3 Features To Keep,
$(LI The $(B compile/link/debug) development model is
carried forward,
although nothing precludes D from being compiled into bytecode
and interpreted.
and interpreted.
)

$(LI $(B Exception handling).
More and more experience with exception handling shows it to be a
More and more experience with exception handling shows it to be a
superior way to handle errors than the C traditional method of using
error codes and errno globals.
)

$(LI $(B Runtime Type Identification).
This is partially implemented in C++;
in D it is taken to its
in D it is taken to its
next logical step. Fully supporting it enables better garbage
collection, better debugger support, more automated persistence, etc.
)

$(LI D maintains function link compatibility with the $(B C calling
conventions). This makes
conventions). This makes
it possible for D programs to access operating system API's directly.
Programmers' knowledge and experience with existing programming API's
and paradigms can be carried forward to D with minimal effort.
Expand All @@ -207,7 +206,7 @@ $(SECTION3 Features To Keep,
$(LI $(B Template Metaprogramming).
Templates are a way to implement generic programming.
Other ways include using macros or having a variant data type.
Using macros is out. Variants are straightforward, but
Using macros is out. Variants are straightforward, but
inefficient and lack type checking.
The difficulties with C++ templates are their
complexity, they don't fit well into the syntax of the language,
Expand Down Expand Up @@ -236,7 +235,7 @@ $(SECTION3 Features To Drop,

$(UL
$(LI C source code compatibility. Extensions to C that maintain
source compatibility
source compatibility
have already been done (C++ and ObjectiveC). Further work in this
area is hampered by so much legacy code it is unlikely that significant
improvements can be made.
Expand Down Expand Up @@ -357,11 +356,11 @@ $(UL
to eliminate bugs before the code is even compiled.
)

$(LI People who compile with maximum warning levels turned on and who
$(LI People who compile with maximum warning levels turned on and who
instruct the compiler to treat warnings as errors.
)

$(LI Programming managers who are forced to rely on programming style
$(LI Programming managers who are forced to rely on programming style
guidelines to avoid common C bugs.
)

Expand All @@ -382,7 +381,7 @@ $(UL
)

$(LI Programmers who think the language should provide enough
features to obviate
features to obviate
the continual necessity to manipulate pointers directly.
)

Expand All @@ -402,9 +401,9 @@ $(UL
of Ruby and Python, making it possible to write the entire app
in one language.)

$(LI D's lexical analyzer and parser are totally independent of each other and of the
semantic analyzer. This means it is easy to write simple tools to manipulate D source
perfectly without having to build a full compiler. It also means that source code can be
$(LI D's lexical analyzer and parser are totally independent of each other and of the
semantic analyzer. This means it is easy to write simple tools to manipulate D source
perfectly without having to build a full compiler. It also means that source code can be
transmitted in tokenized form for specialized applications.
)
)
Expand All @@ -416,7 +415,7 @@ $(SECTION3 Who D is Not For,
$(LI Realistically, nobody is going to convert million line C or C++
programs into D.
Since D does not compile unmodified C/C++
source code, D is not for
source code, D is not for
legacy apps.
(However, D supports legacy C API's very well. D can connect
directly to any code that exposes a C interface.)
Expand Down Expand Up @@ -496,7 +495,7 @@ $(SECTION3 Productivity,
Instead of #include'ing the text of a file of declarations,
just import the module. There is no need to worry about
multiple imports of the same module, no need to wrapper header
files with $(TT #ifndef/#endif) or $(TT #pragma once) kludges,
files with $(D #ifndef/#endif) or $(D #pragma once) kludges,
etc.
)
)
Expand All @@ -505,9 +504,9 @@ $(SECTION3 Productivity,

$(P C++ usually requires that functions and classes be declared twice - the declaration
that goes in the .h header file, and the definition that goes in the .c source
file. This is an error prone and tedious process. Obviously, the programmer
should only need to write it once, and the compiler should then extract the
declaration information and make it available for symbolic importing. This is
file. This is an error prone and tedious process. Obviously, the programmer
should only need to write it once, and the compiler should then extract the
declaration information and make it available for symbolic importing. This is
exactly how D works.
)

Expand All @@ -533,7 +532,7 @@ int ABC::z = 7;
extern int q;
)

$(P Note: Of course, in C++, trivial functions like $(TT { return 7; })
$(P Note: Of course, in C++, trivial functions like $(D { return 7; })
are written inline too, but complex ones are not. In addition, if
there are any forward references, the functions need to be prototyped.
The following will not work in C++:
Expand Down Expand Up @@ -711,24 +710,24 @@ $(SECTION3 Arrays,
$(LI Dimension information is not carried around with
the array, and so has to be stored and passed separately.
The classic example of this are the argc and argv
parameters to $(TT main(int $(D_PARAM argc), char *$(D_PARAM argv)[])).
(In D, main is declared as $(TT main(char[][] $(D_PARAM args))).)
parameters to $(D main(int $(D_PARAM argc), char *$(D_PARAM argv)[])).
(In D, main is declared as $(D main(char[][] $(D_PARAM args))).)
)

$(LI Arrays are not first class objects. When an array is passed to a function, it is
converted to a pointer, even though the prototype confusingly says it's an
converted to a pointer, even though the prototype confusingly says it's an
array. When this conversion happens, all array type information
gets lost.
)

$(LI C arrays cannot be resized. This means that even simple aggregates like a stack
$(LI C arrays cannot be resized. This means that even simple aggregates like a stack
need to be constructed as a complex class.)

$(LI C arrays cannot be bounds checked, because they don't know
what the array bounds are.)

$(LI Arrays are declared with the [] after the identifier. This leads to
very clumsy
very clumsy
syntax to declare things like a pointer to an array:

$(CCODE
Expand Down Expand Up @@ -852,7 +851,7 @@ $(SECTION3 Reliability,

$(P A modern language should do all it can to help the programmer flush
out bugs in the code. Help can come in many forms;
from making it easy to use more robust techniques,
from making it easy to use more robust techniques,
to compiler flagging of obviously incorrect code, to runtime checking.
)

Expand Down Expand Up @@ -1081,7 +1080,7 @@ $(SECTION2 Sample D Program (sieve.d),
import std.stdio;

bool[8191] flags;

int main()
{ int i, count, prime, k, iter;

Expand Down
6 changes: 3 additions & 3 deletions portability.dd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ $(SPEC_S Portability Guide,
Techniques to minimize potential portability problems are:
)

$(UL
$(UL

$(LI The integral and floating type sizes should be considered as
minimums.
Expand Down Expand Up @@ -47,7 +47,7 @@ a + b + c
$(LI Avoid dependence on the size of a pointer or reference being
the same size as a particular integral type.)

$(LI If size dependencies are inevitable, put an $(TT assert) in
$(LI If size dependencies are inevitable, put an $(D assert) in
the code to verify it:

-------
Expand All @@ -62,7 +62,7 @@ assert(int.sizeof == (int*).sizeof);
With that in mind:
)

$(UL
$(UL

$(LI Integral types will remain the same sizes between
32 and 64 bit code.)
Expand Down
38 changes: 19 additions & 19 deletions pretod.dd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $(COMMUNITY The C Preprocessor Versus D,
D provides a more scalable means to solve the same problems.
)

$(UL
$(UL
$(LI <a href="#headerfiles">Header Files</a>)
$(LI <a href="#pragmaonce">#pragma once</a>)
$(LI <a href="#pragmapack">#pragma pack</a>)
Expand All @@ -37,7 +37,7 @@ $(CWAY
This is done with the import statement. Symbolic inclusion means the compiler
just loads an already compiled symbol table. The needs for macro "wrappers" to
prevent multiple #inclusion, funky #pragma once syntax, and incomprehensible
fragile syntax for precompiled headers are simply unnecessary and irrelevant to
fragile syntax for precompiled headers are simply unnecessary and irrelevant to
D.
)

Expand Down Expand Up @@ -118,24 +118,24 @@ struct Foo
they have a downside:
)

$(UL
$(UL
$(LI Macros have no concept of scope; they are valid from the point of definition
to the end of the source. They cut a swath across .h files, nested code, etc. When
#include'ing tens of thousands of lines of macro definitions, it becomes
#include'ing tens of thousands of lines of macro definitions, it becomes
problematical to avoid inadvertent macro expansions.
)

$(LI Macros are unknown to the debugger. Trying to debug a program with
symbolic data is undermined by the debugger only knowing about macro
$(LI Macros are unknown to the debugger. Trying to debug a program with
symbolic data is undermined by the debugger only knowing about macro
expansions, not the macros themselves.
)

$(LI Macros make it impossible to tokenize source code, as an earlier macro change
$(LI Macros make it impossible to tokenize source code, as an earlier macro change
can arbitrarily redo tokens.
)

$(LI The purely textual basis of macros leads to arbitrary and inconsistent usage,
making code using macros error prone. (Some attempt to resolve this was
making code using macros error prone. (Some attempt to resolve this was
introduced with templates in C++.)
)

Expand All @@ -149,7 +149,7 @@ $(UL
corresponding feature in D:
)

$(OL
$(OL
$(LI Defining literal constants:

$(CWAY
Expand Down Expand Up @@ -419,7 +419,7 @@ $(CWAY
$(P Conditional compilation is a powerful feature of the C preprocessor,
but it has its downside:)

$(UL
$(UL
$(LI The preprocessor has no concept of scope. #if/#endif can be
interleaved with code in a completely unstructured and disorganized
fashion, making things difficult to follow.
Expand All @@ -444,7 +444,7 @@ $(DWAY

$(P D supports conditional compilation:)

$(OL
$(OL
$(LI Separating version specific functionality into separate modules.
)

Expand Down Expand Up @@ -504,7 +504,7 @@ while (1)
$(P This suffers from numerous problems:
)

$(OL
$(OL
$(LI The macros must evaluate to expressions and cannot declare
any variables. Consider the difficulty of extending them to
check for stack overflow/underflow.
Expand Down Expand Up @@ -553,7 +553,7 @@ while (1)

$(P The problems addressed are:)

$(OL
$(OL
$(LI The nested functions have available the full expressive
power of D functions. The array accesses already are bounds
checked (adjustable by compile time switch).
Expand Down Expand Up @@ -582,7 +582,7 @@ while (1)

$(CWAY

$(P The first way is to use the $(TT #error) preprocessing directive:
$(P The first way is to use the $(D #error) preprocessing directive:
)

$(CCODE
Expand All @@ -594,12 +594,12 @@ $(CCODE
)

$(P This has the limitations inherent in preprocessor expressions
(i.e. integer constant expressions only, no casts, no $(TT sizeof),
(i.e. integer constant expressions only, no casts, no $(D sizeof),
no symbolic constants, etc.).
)

$(P These problems can be circumvented to some extent by defining a
$(TT static_assert) macro (thanks to M. Wilson):
$(D static_assert) macro (thanks to M. Wilson):
)

$(CCODE
Expand All @@ -620,7 +620,7 @@ void foo(T t)
evaluates
to false. The limitations of this technique are a sometimes very
confusing error message from the compiler, along with an inability
to use a $(TT static_assert) outside of a function body.
to use a $(D static_assert) outside of a function body.
)
)

Expand Down Expand Up @@ -667,15 +667,15 @@ else
But the advantages of mixins over macros are:
)

$(OL
$(OL
$(LI Mixins substitute in parsed declaration trees that pass muster with
the language syntax, macros substitute in arbitrary preprocessor tokens
that have no organization.
)

$(LI Mixins are in the same language. Macros are a separate and
distinct language layered on top of C++, with its own expression rules,
its own types, its distinct symbol table, its own scoping rules, etc.
its own types, its distinct symbol table, its own scoping rules, etc.
)

$(LI Mixins are selected based on partial specialization rules, macros
Expand Down
8 changes: 4 additions & 4 deletions rationale.dd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class A

<h3>Why not allow globally defined operator overload functions?</h3>

$(OL
$(OL
$(LI Operator overloading can only be done with an argument
as an object, so they logically belong as member functions
of that object. That does leave the case of what to do
Expand Down Expand Up @@ -119,7 +119,7 @@ infinity of a floating point type, rather than doing it in a library like C++:
language, why build it in to the core language?)
In regards to T.infinity:

$(OL
$(OL
$(LI Building it in to the core language means the core language knows
what a floating point infinity is. Being layered in templates, typedefs,
casts, const bit patterns, etc., it doesn't know what it is, and is
Expand Down Expand Up @@ -163,11 +163,11 @@ infinity of a floating point type, rather than doing it in a library like C++:
------
$(P if the NaNs are done correctly.)

<h2>Why use $(TT static if(0)) rather than $(TT if (0)?)</h2>
<h2>Why use $(D static if(0)) rather than $(D if (0)?)</h2>

$(P Some limitations are:)

$(OL
$(OL
$(LI if (0) introduces a new scope, static if(...) does not. Why does this
matter? It matters if one wants to conditionally declare a new variable:

Expand Down
6 changes: 3 additions & 3 deletions regular-expression.dd
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ s = RegExp(r"p[1-5]\s*");
auto r = RegExp("pattern");
auto s = RegExp(r"p[1-5]\s*");
---

$(P To check for a match of a string $(I s) with a regular expression
in Ruby, use the =~ operator, which returns the index of the
first match:)
Expand Down Expand Up @@ -120,7 +120,7 @@ sub(s, "a", "ZZ"); // result: StrZZp a rocket engine on a chicken.
sub(s, "a", "ZZ", "g"); // result: StrZZp ZZ rocket engine on ZZ chicken.
---

$(P The replacement string can reference the matches using
$(P The replacement string can reference the matches using
the $&amp;, $$, $', $`, $0 .. $99 notation:)

---
Expand All @@ -135,7 +135,7 @@ sub(s, "[ar]",
"g"); // result: StRAp A Rocket engine on A chicken.
---

($(TT toupper()) comes from $(LINK2 phobos/std_string.html, std.string).)
($(D toupper()) comes from $(LINK2 phobos/std_string.html, std.string).)

<h2>Looping</h2>

Expand Down
6 changes: 3 additions & 3 deletions sitemap-template.dd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Ddoc

$(D_S Site Index, $(LINKS))
$(D_S Sitemap, $(LINKS))

Macros:
TITLE=Siteindex
WIKI=Siteindex
TITLE=Sitemap
WIKI=Sitemap
LINKS=
14 changes: 7 additions & 7 deletions statement.dd
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ $(I ExpressionStatement):
The expression is evaluated.
<p>

Expressions that have no effect, like $(TT (x + x)),
Expressions that have no effect, like $(D (x + x)),
are illegal
in expression statements.
If such an expression is needed, casting it to $(D_KEYWORD void) will
Expand Down Expand Up @@ -570,15 +570,15 @@ $(V2

$(TABLE2 Foreach Range Properties,
$(TR $(TH Property) $(TH Purpose ))
$(TR $(TD $(TT .empty)) $(TD returns true if no more elements))
$(TR $(TD $(TT .front)) $(TD return the leftmost element of the range))
$(TR $(TD $(TT .back)) $(TD return the rightmost element of the range))
$(TR $(TD $(D .empty)) $(TD returns true if no more elements))
$(TR $(TD $(D .front)) $(TD return the leftmost element of the range))
$(TR $(TD $(D .back)) $(TD return the rightmost element of the range))
)

$(TABLE2 Foreach Range Methods,
$(TR $(TH Method) $(TH Purpose ))
$(TR $(TD $(TT .popFront())) $(TD move the left edge of the range right one))
$(TR $(TD $(TT .popBack())) $(TD move the right edge of the range left one))
$(TR $(TD $(D .popFront())) $(TD move the left edge of the range right one))
$(TR $(TD $(D .popBack())) $(TD move the right edge of the range left one))
)

$(P Meaning:)
Expand Down Expand Up @@ -613,7 +613,7 @@ for (auto __r = range; !__r.empty; __r.popBack())
}
---

$(P If the foreach range properties do not exist, the $(TT opApply)
$(P If the foreach range properties do not exist, the $(D opApply)
method will be used instead.
)
)
Expand Down
4 changes: 2 additions & 2 deletions struct.dd
Original file line number Diff line number Diff line change
Expand Up @@ -472,9 +472,9 @@ t.a = 3;
S s = t; // s.a is set to 3
----

$(P If $(TT opCall) is overridden for the struct, and the struct
$(P If $(D opCall) is overridden for the struct, and the struct
is initialized with a value that is of a different type,
then the $(TT opCall) operator is called:)
then the $(D opCall) operator is called:)

----
struct S {
Expand Down
Loading