diff -uNr dmd-0.156/dmd/html/d/abi.html dmd-0.157/dmd/html/d/abi.html --- dmd-0.156/dmd/html/d/abi.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/abi.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
Last update Wed Apr 26 22:34:30 2006 +
Last update Mon May 8 15:25:42 2006
@@ -57,97 +57,66 @@ · Lexical
- · Modules
- · Declarations
- · Types
- · Properties
- · Attributes
- · Pragmas
- · Expressions
- · Statements
- · Arrays
- · Structs & Unions
- · Classes
- · Interfaces
- · Enums
- · Functions
- · Operator Overloading
- · Templates
- · Mixins
- · Contracts
- · Conditional Compilation
- · Handling errors
- · Garbage Collection
- · Memory Management
- · Floating Point
- · Inline Assembler
- · Documentation Comments
- · Interfacing To C
- · Portability Guide
- · Embedding D in HTML
- · Named Character Entities
- · Application Binary Interface
-
@@ -204,7 +173,7 @@ The class definition: -
class XXXX
+
class XXXX
 {
     ....
 };
@@ -266,15 +235,15 @@
 	When passing a static array to a function, the result, although declared as a static array, will
 	actually be a reference to a static array. For example:
 
-
int abc[3];
+
int abc[3];
 
Passing abc to functions results in these implicit conversions: -
void func(int array[3]); // actually <reference to><array[3] of><int>
-void func(int *p);       // abc[3] is converted to a pointer
-			 // to the first element
-void func(int array[]);	 // abc[3] is converted to a dynamic array
+
void func(int array[3]); // actually <reference to><array[3] of><int>
+void func(int *p);       // abc[3] is converted to a pointer
+			 // to the first element
+void func(int array[]);	 // abc[3] is converted to a dynamic array
 
diff -uNr dmd-0.156/dmd/html/d/acknowledgements.html dmd-0.157/dmd/html/d/acknowledgements.html --- dmd-0.156/dmd/html/d/acknowledgements.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/acknowledgements.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
Last update Wed Apr 26 22:34:31 2006 +
Last update Mon May 8 15:25:43 2006
@@ -57,131 +57,94 @@ · Overview
- · D for Win32
- · Win32 DLLs in D
- · C .h to D Modules
- · FAQ
- · Style Guide
- · Example: wc
- · Future
- · D Change Log
- · Tech Tips
- · Rationale
- · Warnings
-
Articles
· Exception Safety
- · Templates Revisited
-
Tools
· DMD D Compiler
- · GDC D Compiler
- · Linker
- · Profiler
- · Code Coverage
- · DMD Script Shell
- · Windows Debugger
-
Community
· News
- · Forum
- · Announcements
- · Learn
- · D links
-
Archives
· digitalmars.D
- · digitalmars.D.dtl
- · digitalmars.D.announce
- · digitalmars.D.dwt
- · digitalmars.D.learn
- · digitalmars.D.bugs
- · D.gnu
- · Old D
-
Appendices
· Glossary
- · Ascii Table
- · Acknowledgements
-
@@ -195,7 +158,8 @@ and moral support.

-

Kris Bell, +

Andrei Alexandrescu, + Kris Bell, Don Clugston, Hauke Duden, Bruce Eckel, @@ -203,8 +167,10 @@ Dave Fladebo, David Friedman, Stewart Gordon, + Christian Hartung, Ben Hinkle, - Jan Knepper, + Kazuhiro Inaba, + Jan Knepper, Thomas Kuehne, Helmut Leitner, Lubomir Litchev, diff -uNr dmd-0.156/dmd/html/d/arrays.html dmd-0.157/dmd/html/d/arrays.html --- dmd-0.156/dmd/html/d/arrays.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/arrays.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -

Last update Wed Apr 26 22:34:30 2006 +
Last update Mon May 8 15:25:41 2006
@@ -57,97 +57,66 @@ · Lexical
- · Modules
- · Declarations
- · Types
- · Properties
- · Attributes
- · Pragmas
- · Expressions
- · Statements
- · Arrays
- · Structs & Unions
- · Classes
- · Interfaces
- · Enums
- · Functions
- · Operator Overloading
- · Templates
- · Mixins
- · Contracts
- · Conditional Compilation
- · Handling errors
- · Garbage Collection
- · Memory Management
- · Floating Point
- · Inline Assembler
- · Documentation Comments
- · Interfacing To C
- · Portability Guide
- · Embedding D in HTML
- · Named Character Entities
- · Application Binary Interface
-
@@ -158,8 +127,7 @@ There are four kinds of arrays:

- -
int* p; Pointers to data +
int* p; Pointers to data
int[3] s; Static arrays @@ -170,7 +138,7 @@

Pointers

-
int* p;
+
int* p;
 
These are simple pointers to data, analogous to C pointers. @@ -185,7 +153,7 @@

Static Arrays

-
int[3] s;
+
int[3] s;
 
These are analogous to C arrays. Static arrays are distinguished @@ -203,7 +171,7 @@

Dynamic Arrays

-
int[] a;
+
int[] a;
 
Dynamic arrays consist of a length and a pointer to the array data. @@ -220,11 +188,11 @@ Prefix declarations appear before the identifier being declared and read right to left, so: -
int[] a;	// dynamic array of ints
-int[4][3] b;	// array of 3 arrays of 4 ints each
-int[][5] c;	// array of 5 dynamic arrays of ints.
-int*[]*[3] d;	// array of 3 pointers to dynamic arrays of pointers to ints
-int[]* e;	// pointer to dynamic array of ints
+
int[] a;	// dynamic array of ints
+int[4][3] b;	// array of 3 arrays of 4 ints each
+int[][5] c;	// array of 5 dynamic arrays of ints.
+int*[]*[3] d;	// array of 3 pointers to dynamic arrays of pointers to ints
+int[]* e;	// pointer to dynamic array of ints
 
@@ -234,28 +202,28 @@ declared and read left to right. Each group lists equivalent declarations: -
// dynamic array of ints
-int[] a;
-int a[];
-
-// array of 3 arrays of 4 ints each
-int[4][3] b;
-int[4] b[3];
-int b[3][4];
-
-// array of 5 dynamic arrays of ints.
-int[][5] c;
-int[] c[5];
-int c[5][];
-
-// array of 3 pointers to dynamic arrays of pointers to ints
-int*[]*[3] d;
-int*[]* d[3];
-int* (*d[3])[];
-
-// pointer to dynamic array of ints
-int[]* e;
-int (*e[]);
+
// dynamic array of ints
+int[] a;
+int a[];
+
+// array of 3 arrays of 4 ints each
+int[4][3] b;
+int[4] b[3];
+int b[3][4];
+
+// array of 5 dynamic arrays of ints.
+int[][5] c;
+int[] c[5];
+int c[5][];
+
+// array of 3 pointers to dynamic arrays of pointers to ints
+int*[]*[3] d;
+int*[]* d[3];
+int* (*d[3])[];
+
+// pointer to dynamic array of ints
+int[]* e;
+int (*e[]);
 
Rationale: The postfix form matches the way arrays are @@ -274,25 +242,25 @@ The handle to an array is specified by naming the array, as in p, s or a: -
int* p;
-int[3] s;
-int[] a;
-
-int* q;
-int[3] t;
-int[] b;
-
-p = q;		// p points to the same thing q does.
-p = s;		// p points to the first element of the array s.
-p = a;		// p points to the first element of the array a.
+
int* p;
+int[3] s;
+int[] a;
+
+int* q;
+int[3] t;
+int[] b;
+
+p = q;		// p points to the same thing q does.
+p = s;		// p points to the first element of the array s.
+p = a;		// p points to the first element of the array a.
 
-s = ...;	// error, since s is a compiled in static
-		// reference to an array.
+s = ...;	// error, since s is a compiled in static
+		// reference to an array.
 
-a = p;		// error, since the length of the array pointed
-		// to by p is unknown
-a = s;		// a is initialized to point to the s array
-a = b;		// a points to the same array as b does
+a = p;		// error, since the length of the array pointed
+		// to by p is unknown
+a = s;		// a is initialized to point to the s array
+a = b;		// a points to the same array as b does
 

Slicing

@@ -302,21 +270,21 @@ reference to it. For example: -
int[10] a;	// declare array of 10 ints
-int[] b;
+
int[10] a;	// declare array of 10 ints
+int[] b;
 
-b = a[1..3];	// a[1..3] is a 2 element array consisting of
-		// a[1] and a[2]
-foo(b[1]);	// equivalent to foo(0)
+b = a[1..3];	// a[1..3] is a 2 element array consisting of
+		// a[1] and a[2]
+foo(b[1]);	// equivalent to foo(0)
 a[2] = 3;
-foo(b[1]);	// equivalent to foo(3)
+foo(b[1]);	// equivalent to foo(3)
 
The [] is shorthand for a slice of the entire array. For example, the assignments to b: -
int[10] a;
-int[] b;
+
int[10] a;
+int[] b;
 
 b = a;
 b = a[];
@@ -330,8 +298,8 @@
 	is not only handy for referring to parts of other arrays,
 	but for converting pointers into bounds-checked arrays:
 
-
int* p;
-int[] b = p[0..8];
+
int* p;
+int[] b = p[0..8];
 

Array Copying

@@ -342,21 +310,21 @@ Array copying happens when the lvalue is a slice, and the rvalue is an array of or pointer to the same type. -
int[3] s;
-int[3] t;
+
int[3] s;
+int[3] t;
 
-s[] = t;		// the 3 elements of t[3] are copied into s[3]
-s[] = t[];		// the 3 elements of t[3] are copied into s[3]
-s[1..2] = t[0..1];	// same as s[1] = t[0]
-s[0..2] = t[1..3];	// same as s[0] = t[1], s[1] = t[2]
-s[0..4] = t[0..4];	// error, only 3 elements in s
-s[0..2] = t;		// error, different lengths for lvalue and rvalue
+s[] = t;		// the 3 elements of t[3] are copied into s[3]
+s[] = t[];		// the 3 elements of t[3] are copied into s[3]
+s[1..2] = t[0..1];	// same as s[1] = t[0]
+s[0..2] = t[1..3];	// same as s[0] = t[1], s[1] = t[2]
+s[0..4] = t[0..4];	// error, only 3 elements in s
+s[0..2] = t;		// error, different lengths for lvalue and rvalue
 
Overlapping copies are an error: -
s[0..2] = s[1..3];	// error, overlapping copy
-s[1..3] = s[0..2];	// error, overlapping copy
+
s[0..2] = s[1..3];	// error, overlapping copy
+s[1..3] = s[0..2];	// error, overlapping copy
 
Disallowing overlapping makes it possible for more aggressive @@ -370,11 +338,11 @@ type of the lvalue, then the lvalue's array contents are set to the rvalue. -
int[3] s;
-int* p;
+
int[3] s;
+int* p;
 
-s[] = 3;		// same as s[0] = 3, s[1] = 3, s[2] = 3
-p[0..2] = 3;		// same as p[0] = 3, p[1] = 3
+s[] = 3;		// same as s[0] = 3, s[1] = 3, s[2] = 3
+p[0..2] = 3;		// same as p[0] = 3, p[1] = 3
 

Array Concatenation

@@ -382,18 +350,18 @@ The binary operator ~ is the cat operator. It is used to concatenate arrays: -
int[] a;
-int[] b;
-int[] c;
+
int[] a;
+int[] b;
+int[] c;
 
-a = b ~ c;	// Create an array from the concatenation of the
-		// b and c arrays
+a = b ~ c;	// Create an array from the concatenation of the
+		// b and c arrays
 
Many languages overload the + operator to mean concatenation. This confusingly leads to, does: -
"10" + 3
+
"10" + 3
 
produce the number 13 or the string "103" as the result? It isn't @@ -405,14 +373,14 @@ Similarly, the ~= operator means append, as in: -
a ~= b;		// a becomes the concatenation of a and b
+
a ~= b;		// a becomes the concatenation of a and b
 
Concatenation always creates a copy of its operands, even if one of the operands is a 0 length array, so: -
a = b;			// a refers to b
-a = b ~ c[0..0];	// a refers to a copy of b
+
a = b;			// a refers to b
+a = b ~ c[0..0];	// a refers to a copy of b
 
@@ -422,30 +390,30 @@ When more than one [] operator appears in an expression, the range represented by all must match. -
a[1..3] = b[] + 3;	// error, 2 elements not same as 3 elements
+
a[1..3] = b[] + 3;	// error, 2 elements not same as 3 elements
 

Examples:

-
int[3] abc;			// static array of 3 ints
-int[] def = [ 1, 2, 3 ];	// dynamic array of 3 ints
+
int[3] abc;			// static array of 3 ints
+int[] def = [ 1, 2, 3 ];	// dynamic array of 3 ints
 
-void dibb(int *array)
+void dibb(int *array)
 {
-	array[2];		// means same thing as *(array + 2)
-	*(array + 2);		// get 2nd element
+	array[2];		// means same thing as *(array + 2)
+	*(array + 2);		// get 2nd element
 }
 
-void diss(int[] array)
+void diss(int[] array)
 {
-	array[2];		// ok
-	*(array + 2);		// error, array is not a pointer
+	array[2];		// ok
+	*(array + 2);		// error, array is not a pointer
 }
 
-void ditt(int[3] array)
+void ditt(int[3] array)
 {
-	array[2];		// ok
-	*(array + 2);		// error, array is not a pointer
+	array[2];		// ok
+	*(array + 2);		// error, array is not a pointer
 }
 
@@ -456,7 +424,7 @@ access them via pointers to pointers resulting from "array of pointers to array" semantics. For example, the D syntax: -
double[][] matrix;
+
double[][] matrix;
 
declares matrix as an array of pointers to arrays. (Dynamic arrays are implemented as @@ -465,13 +433,13 @@ array rows can sometimes point to each other! Fortunately, D static arrays, while using the same syntax, are implemented as a fixed rectangular layout: -
double[3][3] matrix;
+
double[3][3] matrix;
 
declares a rectangular matrix with 3 rows and 3 columns, all contiguously in memory. In other languages, this would be called a multidimensional array and be declared as: -
double matrix[3,3];
+
double matrix[3,3];
 

Array Length

@@ -480,27 +448,26 @@ the variable length is implicitly declared and set to the length of the array. -
int[4] foo;
-int[]  bar = foo;
-int*   p = &foo[0];
+
int[4] foo;
+int[]  bar = foo;
+int*   p = &foo[0];
 
-// These expressions are equivalent:
+// These expressions are equivalent:
 bar[]
 bar[0 .. 4]
 bar[0 .. length]
 bar[0 .. bar.length]
 
-p[0 .. length]		// 'length' is not defined, since p is not an array
-bar[0]+length		// 'length' is not defined, out of scope of [ ]
+p[0 .. length]		// 'length' is not defined, since p is not an array
+bar[0]+length		// 'length' is not defined, out of scope of [ ]
 
-bar[length-1]	// retrieves last element of the array
+bar[length-1]	// retrieves last element of the array
 

Array Properties

Static array properties are: - - +
.sizeof Returns the array length multiplied by the number of bytes per array element. @@ -534,8 +501,7 @@ Dynamic array properties are: - - +
.sizeof Returns the size of the dynamic array reference, which is 8 on 32 bit machines. @@ -568,15 +534,15 @@ Examples: -
p.length	// error, length not known for pointer
-s.length	// compile time constant 3
-a.length	// runtime value
+
p.length	// error, length not known for pointer
+s.length	// compile time constant 3
+a.length	// runtime value
 
-p.dup		// error, length not known
-s.dup		// creates an array of 3 elements, copies
-		// elements s into it
-a.dup		// creates an array of a.length elements, copies
-		// elements of a into it
+p.dup		// error, length not known
+s.dup		// creates an array of 3 elements, copies
+		// elements s into it
+a.dup		// creates an array of a.length elements, copies
+		// elements of a into it
 

Setting Dynamic Array Length

@@ -604,24 +570,24 @@ This means that if there is an array slice immediately following the array being resized, the resized array could overlap the slice; i.e.: -
char[] a = new char[20];
-char[] b = a[0..10];
-char[] c = a[10..20];
-
-b.length = 15;	// always resized in place because it is sliced
-		// from a[] which has enough memory for 15 chars
-b[11] = 'x';	// a[15] and c[5] are also affected
+
char[] a = new char[20];
+char[] b = a[0..10];
+char[] c = a[10..20];
+
+b.length = 15;	// always resized in place because it is sliced
+		// from a[] which has enough memory for 15 chars
+b[11] = 'x';	// a[15] and c[5] are also affected
 
 a.length = 1;
-a.length = 20;	// no net change to memory layout
+a.length = 20;	// no net change to memory layout
 
-c.length = 12;	// always does a copy because c[] is not at the
-		// start of a gc allocation block
-c[5] = 'y';	// does not affect contents of a[] or b[]
+c.length = 12;	// always does a copy because c[] is not at the
+		// start of a gc allocation block
+c[5] = 'y';	// does not affect contents of a[] or b[]
 
-a.length = 25;	// may or may not do a copy
-a[3] = 'z';	// may or may not affect b[3] which still overlaps
-		// the old a[3]
+a.length = 25;	// may or may not do a copy
+a[3] = 'z';	// may or may not affect b[3] which still overlaps
+		// the old a[3]
 
To guarantee copying behavior, use the .dup property to ensure @@ -635,11 +601,11 @@ Resizing a dynamic array is a relatively expensive operation. So, while the following method of filling an array: -
int[] array;
-while (1)
+
int[] array;
+while (1)
 {   c = getinput();
-    if (!c)
-       break;
+    if (!c)
+       break;
     array.length = array.length + 1;
     array[array.length - 1] = c;
 }
@@ -648,13 +614,13 @@
 	will work, it will be inefficient. A more practical
 	approach would be to minimize the number of resizes:
 
-
int[] array;
-array.length = 100;        // guess
-for (i = 0; 1; i++)
+
int[] array;
+array.length = 100;        // guess
+for (i = 0; 1; i++)
 {   c = getinput();
-     if (!c)
-	break;
-     if (i == array.length)
+     if (!c)
+	break;
+     if (i == array.length)
 	array.length = array.length * 2;
      array[i] = c;
 }
@@ -675,22 +641,22 @@
 	A program may not rely on array bounds checking happening, for
 	example, the following program is incorrect:
 
-
try
+
try
 {
-    for (i = 0; ; i++)
+    for (i = 0; ; i++)
     {
 	array[i] = 5;
     }
 }
-catch (ArrayBoundsError)
+catch (ArrayBoundsError)
 {
-    // terminate loop
+    // terminate loop
 }
 
The loop is correctly written: -
for (i = 0; i < array.length; i++)
+
for (i = 0; i < array.length; i++)
 {
     array[i] = 5;
 }
@@ -699,8 +665,8 @@
 	Implementation Note: Compilers should attempt to detect
 	array bounds errors at compile time, for example:
 
-
int[3] foo;
-int x = foo[3];		// error, out of bounds
+
int[3] foo;
+int x = foo[3];		// error, out of bounds
 
Insertion of array bounds checking code at runtime should be @@ -730,14 +696,14 @@

Static Initialization of Static Arrays

-
int[3] a = [ 1:2, 3 ];		// a[0] = 0, a[1] = 2, a[2] = 3
+
int[3] a = [ 1:2, 3 ];		// a[0] = 0, a[1] = 2, a[2] = 3
 
This is most handy when the array indices are given by enums: -
enum Color { red, blue, green };
+
enum Color { red, blue, green };
 
-int value[Color.max + 1] = [ Color.blue:6, Color.green:2, Color.red:5 ];
+int value[Color.max + 1] = [ Color.blue:6, Color.green:2, Color.red:5 ];
 
If any members of an array are initialized, they all must be. @@ -762,8 +728,8 @@ just a dynamic array of characters. String literals become just an easy way to write character arrays. -
char[] str;
-char[] str1 = "abc";
+
char[] str;
+char[] str1 = "abc";
 
char[] strings are in UTF-8 format. @@ -774,7 +740,7 @@ Strings can be copied, compared, concatenated, and appended:
str1 = str2;
-if (str1 < str3) ...
+if (str1 < str3) ...
 func(str3 ~ str4);
 str4 ~= str1;
 
@@ -787,15 +753,15 @@ A pointer to a char can be generated: -
char *p = &str[3];	// pointer to 4th element
-char *p = str;		// pointer to 1st element
+
char *p = &str[3];	// pointer to 4th element
+char *p = str;		// pointer to 1st element
 
Since strings, however, are not 0 terminated in D, when transferring a pointer to a string to C, add a terminating 0: -
str ~= "\0";
+
str ~= "\0";
 
The type of a string is determined by the semantic phase of @@ -806,7 +772,7 @@ the result is an error. To disambiguate these cases, a cast is appropriate: -
cast(wchar [])"abc"	// this is an array of wchar characters
+
cast(wchar [])"abc"	// this is an array of wchar characters
 
String literals are implicitly converted between chars, @@ -816,16 +782,16 @@ Strings a single character in length can also be exactly converted to a char, wchar or dchar constant: -
char c;
-wchar w;
-dchar d;
-
-c = 'b';		// c is assigned the character 'b'
-w = 'b';		// w is assigned the wchar character 'b'
-w = 'bc';		// error - only one wchar character at a time
-w = "b"[0];		// w is assigned the wchar character 'b'
-w = \r;			// w is assigned the carriage return wchar character
-d = 'd';		// d is assigned the character 'd'
+
char c;
+wchar w;
+dchar d;
+
+c = 'b';		// c is assigned the character 'b'
+w = 'b';		// w is assigned the wchar character 'b'
+w = 'bc';		// error - only one wchar character at a time
+w = "b"[0];		// w is assigned the wchar character 'b'
+w = \r;			// w is assigned the carriage return wchar character
+d = 'd';		// d is assigned the character 'd'
 

printf() and Strings

@@ -835,14 +801,14 @@ to use printf() with D strings. The first is to add a terminating 0, and cast the result to a char*: -
str ~= "\0";
-printf("the string is '%s'\n", (char *)str);
+
str ~= "\0";
+printf("the string is '%s'\n", (char *)str);
 
The second way is to use the precision specifier. The way D arrays are laid out, the length comes first, so the following works: -
printf("the string is '%.*s'\n", str);
+
printf("the string is '%.*s'\n", str);
 
In the future, it may be necessary to just add a new format @@ -897,25 +863,25 @@ Associative arrays are declared by placing the KeyType within the [] of an array declaration: -
int[char[]] b;		// associative array b of ints that are
-			// indexed by an array of characters.
-			// The KeyType is char[]
-b["hello"] = 3;		// set value associated with key "hello" to 3
-func(b["hello"]);	// pass 3 as parameter to func()
+
int[char[]] b;		// associative array b of ints that are
+			// indexed by an array of characters.
+			// The KeyType is char[]
+b["hello"] = 3;		// set value associated with key "hello" to 3
+func(b["hello"]);	// pass 3 as parameter to func()
 
Particular keys in an associative array can be removed with the remove function: -
b.remove("hello");
+
b.remove("hello");
 
The InExpression yields a pointer to the value if the key is in the associative array, or null if not: -
int* p;
-p = ("hello" in b);
-if (p != null)
+
int* p;
+p = ("hello" in b);
+if (p != null)
 	...
 
@@ -927,28 +893,28 @@ data within the struct value. A custom mechanism can be used by providing the following functions as struct members: -
uint toHash();
-int opCmp(KeyType* s);
+
uint toHash();
+int opCmp(KeyType* s);
 
For example: -
import std.string;
+
import std.string;
 
-struct MyString
+struct MyString
 {
-    char[] str;
+    char[] str;
 
-    uint toHash()
-    {   uint hash;
-	foreach (char c; s)
+    uint toHash()
+    {   uint hash;
+	foreach (char c; s)
 	    hash = (hash * 9) + c;
-	return hash;
+	return hash;
     }
 
-    int opCmp(MyString* s)
+    int opCmp(MyString* s)
     {
-	return std.string.cmp(this.str, s.str);
+	return std.string.cmp(this.str, s.str);
     }
 }
 
@@ -958,7 +924,6 @@ Properties for associative arrays are: - diff -uNr dmd-0.156/dmd/html/d/attribute.html dmd-0.157/dmd/html/d/attribute.html --- dmd-0.156/dmd/html/d/attribute.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/attribute.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
Last update Wed Apr 26 22:34:29 2006 +
Last update Mon May 8 15:25:41 2006
@@ -57,105 +57,73 @@ · Lexical
- · Modules
- · Declarations
- · Types
- · Properties
- · Attributes
- · Pragmas
- · Expressions
- · Statements
- · Arrays
- · Structs & Unions
- · Classes
- · Interfaces
- · Enums
- · Functions
- · Operator Overloading
- · Templates
- · Mixins
- · Contracts
- · Conditional Compilation
- · Handling errors
- · Garbage Collection
- · Memory Management
- · Floating Point
- · Inline Assembler
- · Documentation Comments
- · Interfacing To C
- · Portability Guide
- · Embedding D in HTML
- · Named Character Entities
- · Application Binary Interface
-
@@ -192,6 +155,10 @@
    +
  • What's new for D 0.157
  • + +
  • What's new for D 0.156
  • +
  • What's new for D 0.155
  • What's new for D 0.154
  • @@ -413,6 +380,46 @@
    +

    + What's New for + D 0.157 +

    + + +May 10, 2006 + +

    New/Changed Features

    + +
    • Partial Dwarf symbol debug info now generated for Linux.
    • +
    • Improved + dumpobj's + handling of Dwarf symbolic debug info.
    • +
    + +

    Bugs Fixed

    + +
    • Applied Dave Fladebo's fix to gc internal sorting problem.
    • +
    + +
    + +

    + What's New for + D 0.156 +

    + + +Apr 28, 2006 +

    + +

    Bugs Fixed

    + + + +
    +

    What's New for D 0.155 @@ -664,9 +671,9 @@

    New/Changed Features

    -
    • Changed on_scope_exit to scope(exit)
    • -
    • Changed on_scope_success to scope(success)
    • -
    • Changed on_scope_failure to scope(failure)
    • +
      • Changed on_scope_exit to scope(exit)
      • +
      • Changed on_scope_success to scope(success)
      • +
      • Changed on_scope_failure to scope(failure)
      • Changed IfStatement to allow: (auto v = expression), and (type v = expression) forms.
      • & | ^ &= |= ^= ! && || ?: are now only @@ -1736,6 +1743,7 @@
      • fix File.open() error message to say "Cannot open or create file"
      +

    Bugs Fixed

    @@ -1965,6 +1973,7 @@ Fixed major bug in the linux version. +
  • Improved error message for overloaded function mismatches.
  • Added man pages to \dmd\man\man1 (thanks to Anders F Bjorklund)
@@ -2076,6 +2085,7 @@
  • uncommented MmFileStream and cleaned it up to use MmFile's mode property. +

    Bugs Fixed

    diff -uNr dmd-0.156/dmd/html/d/class.html dmd-0.157/dmd/html/d/class.html --- dmd-0.156/dmd/html/d/class.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/class.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
  • @@ -255,32 +218,32 @@ to listing (.lst) files.

    For example, consider the Sieve program:

    -
    /* Eratosthenes Sieve prime number calculation. */
    +
    /* Eratosthenes Sieve prime number calculation. */
      
     bit flags[8191];
      
    -int main()
    -{   int     i, prime, k, count, iter;
    +int main()
    +{   int     i, prime, k, count, iter;
     
    -    printf("10 iterations\n");
    -    for (iter = 1; iter <= 10; iter++)
    +    printf("10 iterations\n");
    +    for (iter = 1; iter <= 10; iter++)
         {	count = 0;
    -	flags[] = true;
    -	for (i = 0; i < flags.length; i++)
    -	{   if (flags[i])
    +	flags[] = true;
    +	for (i = 0; i < flags.length; i++)
    +	{   if (flags[i])
     	    {	prime = i + i + 3;
     		k = i + prime;
    -		while (k < flags.length)
    +		while (k < flags.length)
     		{
    -		    flags[k] = false;
    +		    flags[k] = false;
     		    k += prime;
     		}
     		count += 1;
     	    }
     	}
         }
    -    printf ("\n%d primes\n", count);
    -    return 0;
    +    printf ("\n%d primes\n", count);
    +    return 0;
     }
     
    diff -uNr dmd-0.156/dmd/html/d/comparison.html dmd-0.157/dmd/html/d/comparison.html --- dmd-0.156/dmd/html/d/comparison.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/comparison.html 2006-05-08 15:25:44.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -56,42 +56,36 @@ · D vs C/C++/C#/Java
    - · Rationale for Builtins
    - · Converting C to D
    - · Converting C++ to D
    - · The C Preprocessor vs D
    - · D strings vs C++ std::string
    - · D complex vs C++ std::complex
    - · D Contract Programming vs C++
    -
    .sizeof Returns the size of the reference to the associative @@ -992,75 +957,75 @@

    Associative Array Example: word count

    -
    import std.file;		// D file I/O
    +
    import std.file;		// D file I/O
     
    -int main (char[][] args)
    +int main (char[][] args)
     {
    -    int word_total;
    -    int line_total;
    -    int char_total;
    -    int[char[]] dictionary;
    +    int word_total;
    +    int line_total;
    +    int char_total;
    +    int[char[]] dictionary;
     
    -    printf("   lines   words   bytes file\n");
    -    for (int i = 1; i < args.length; ++i)	// program arguments
    +    printf("   lines   words   bytes file\n");
    +    for (int i = 1; i < args.length; ++i)	// program arguments
         {
    -	char[] input;		// input buffer
    -	int w_cnt, l_cnt, c_cnt;	// word, line, char counts
    -	int inword;
    -	int wstart;
    +	char[] input;		// input buffer
    +	int w_cnt, l_cnt, c_cnt;	// word, line, char counts
    +	int inword;
    +	int wstart;
     
    -	input = std.file.read(args[i]);	// read file into input[]
    +	input = std.file.read(args[i]);	// read file into input[]
     
    -	foreach (char c; input)
    +	foreach (char c; input)
     	{
    -	    if (c == '\n')
    +	    if (c == '\n')
     		++l_cnt;
    -	    if (c >= '0' && c <= '9')
    +	    if (c >= '0' && c <= '9')
     	    {
     	    }
    -	    else if (c >= 'a' && c <= 'z' ||
    +	    else if (c >= 'a' && c <= 'z' ||
     		c >= 'A' && c <= 'Z')
     	    {
    -		if (!inword)
    +		if (!inword)
     		{
     		    wstart = j;
     		    inword = 1;
     		    ++w_cnt;
     		}
     	    }
    -	    else if (inword)
    -	    {   char[] word = input[wstart .. j];
    +	    else if (inword)
    +	    {   char[] word = input[wstart .. j];
     
    -		dictionary[word]++;		// increment count for word
    +		dictionary[word]++;		// increment count for word
     		inword = 0;
     	    }
     	    ++c_cnt;
     	}
    -	if (inword)
    -	{   char[] word = input[wstart .. input.length];
    +	if (inword)
    +	{   char[] word = input[wstart .. input.length];
     	    dictionary[word]++;
     	}
    -	printf("%8ld%8ld%8ld %.*s\n", l_cnt, w_cnt, c_cnt, args[i]);
    +	printf("%8ld%8ld%8ld %.*s\n", l_cnt, w_cnt, c_cnt, args[i]);
     	line_total += l_cnt;
     	word_total += w_cnt;
     	char_total += c_cnt;
         }
     
    -    if (args.length > 2)
    +    if (args.length > 2)
         {
    -	printf("-------------------------------------\n%8ld%8ld%8ld total",
    +	printf("-------------------------------------\n%8ld%8ld%8ld total",
     	    line_total, word_total, char_total);
         }
     
    -    printf("-------------------------------------\n");
    -    char[][] keys = dictionary.keys;	// find all words in dictionary[]
    -    for (int i = 0; i < keys.length; i++)
    -    {   char[] word;
    +    printf("-------------------------------------\n");
    +    char[][] keys = dictionary.keys;	// find all words in dictionary[]
    +    for (int i = 0; i < keys.length; i++)
    +    {   char[] word;
     
     	word = keys[i];
    -	printf("%3d %.*s\n", dictionary[word], word);
    +	printf("%3d %.*s\n", dictionary[word], word);
         }
    -    return 0;
    +    return 0;
     }
     
    diff -uNr dmd-0.156/dmd/html/d/ascii-table.html dmd-0.157/dmd/html/d/ascii-table.html --- dmd-0.156/dmd/html/d/ascii-table.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/ascii-table.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -

    Attributes

    -
    -AttributeSpecifier:
    +
    AttributeSpecifier:
         Attribute :
         Attribute DeclarationBlock
     
    @@ -182,7 +150,6 @@
         { DeclDefs }
     
    - Attributes are a way to modify one or more declarations. The general forms are: @@ -226,8 +193,7 @@

    Linkage Attribute

    -
    -LinkageAttribute:
    +
    LinkageAttribute:
     	extern
     	extern ( LinkageType )
     
    @@ -239,7 +205,6 @@
     	Pascal
     
    - D provides an easy way to call C functions and operating system API functions, as compatibility with both is essential. The LinkageType is case sensitive, and is meant to be @@ -254,41 +219,39 @@ C function calling conventions are specified by: -
    extern (C):
    -	int foo();	// call foo() with C conventions
    +
    extern (C):
    +	int foo();	// call foo() with C conventions
     
    D conventions are: -
    extern (D):
    +
    extern (D):
     
    or: -
    extern:
    +
    extern:
     
    Windows API conventions are: -
    extern (Windows):
    -    void *VirtualAlloc(
    -    void *lpAddress,
    -    uint dwSize,
    -    uint flAllocationType,
    -    uint flProtect
    +
    extern (Windows):
    +    void *VirtualAlloc(
    +    void *lpAddress,
    +    uint dwSize,
    +    uint flAllocationType,
    +    uint flProtect
         );
     

    Align Attribute

    -
    -AlignAttribute:
    +
    AlignAttribute:
     	align
     	align ( Integer )
     
    - Specifies the alignment of struct members. align by itself sets it to the default, which matches the default member alignment of the companion C compiler. Integer specifies the alignment @@ -299,9 +262,9 @@ Matching the behavior of the companion C compiler can have some surprising results, such as the following for Digital Mars C++: -
    struct S
    -{   align(4) byte a;	// placed at offset 0
    -    align(4) byte b;	// placed at offset 1
    +
    struct S
    +{   align(4) byte a;	// placed at offset 0
    +    align(4) byte b;	// placed at offset 1
     }
     
    @@ -309,11 +272,11 @@ the same thing as binary compatibility across diverse platforms. For that, use packed structs: -
    align (1) struct S
    -{   byte a;	// placed at offset 0
    -    byte[3] filler1;
    -    byte b;	// placed at offset 4
    -    byte[3] filler2;
    +
    align (1) struct S
    +{   byte a;	// placed at offset 0
    +    byte[3] filler1;
    +    byte b;	// placed at offset 4
    +    byte[3] filler2;
     }
     
    @@ -341,9 +304,9 @@ if any code refers to deprecated declarations: -
    deprecated
    +
    deprecated
     {
    -	void oldFoo();
    +	void oldFoo();
     }
     
    @@ -393,19 +356,17 @@

    Const Attribute

    -
    -const
    +
    const
     
    - The const attribute declares constants that can be evaluated at compile time. For example: -
    const int foo = 7;
    +
    const int foo = 7;
     
    -const
    +const
     {
    -    double bar = foo + 6;
    +    double bar = foo + 6;
     }
     
    @@ -413,45 +374,45 @@ in a constructor (for class fields) or in a static constructor (for static class members, or module variable declarations). -
    const int x;
    -const int y;
    +
    const int x;
    +const int y;
     
    -static this()
    +static this()
     {
    -    x = 3;	// ok
    -    // error: y not initialized
    +    x = 3;	// ok
    +    // error: y not initialized
     }
     
    -void foo()
    +void foo()
     {
    -    x = 4;	// error, x is const and not in static constructor
    +    x = 4;	// error, x is const and not in static constructor
     }
     
    -class C
    +class C
     {
    -    const int a;
    -    const int b;
    -    static const int c;
    -    static const int d;
    -
    -    this()
    -    {   a = 3;		// ok
    -	a = 4;		// ok, multiple initialization allowed
    -	C p = this;
    -	p.a = 4;	// error, only members of this instance
    -	c = 5;		// error, should initialize in static constructor
    -	// error, b is not initialized
    +    const int a;
    +    const int b;
    +    static const int c;
    +    static const int d;
    +
    +    this()
    +    {   a = 3;		// ok
    +	a = 4;		// ok, multiple initialization allowed
    +	C p = this;
    +	p.a = 4;	// error, only members of this instance
    +	c = 5;		// error, should initialize in static constructor
    +	// error, b is not initialized
         }
     
    -    this(int x);
    +    this(int x);
         {
    -	this();		// ok, forwarding constructor
    +	this();		// ok, forwarding constructor
         }
     
    -    static this()
    +    static this()
         {
    -	c = 3;		// ok
    -	// error, d is not initialized
    +	c = 3;		// ok
    +	// error, d is not initialized
         }
     }
     
    @@ -464,11 +425,9 @@

    Override Attribute

    -
    -override
    +
    override
     
    - The override attribute applies to virtual functions. It means that the function must override a function with the same name and parameters in a base class. The override attribute @@ -476,75 +435,70 @@ gets its parameters changed, and all derived classes need to have their overriding functions updated. -
    class Foo
    +
    class Foo
     {
    -    int bar();
    -    int abc(int x);
    +    int bar();
    +    int abc(int x);
     }
     
    -class Foo2 : Foo
    +class Foo2 : Foo
     {
    -    override
    +    override
         {
    -	int bar(char c);	// error, no bar(char) in Foo
    -	int abc(int x);		// ok
    +	int bar(char c);	// error, no bar(char) in Foo
    +	int abc(int x);		// ok
         }
     }
     

    Static Attribute

    -
    -static
    +
    static
     
    - The static attribute applies to functions and data. It means that the declaration does not apply to a particular instance of an object, but to the type of the object. In other words, it means there is no this reference. static is ignored when applied to other declarations. -
    class Foo
    +
    class Foo
     {
    -    static int bar() { return 6; }
    -    int foobar() { return 7; }
    +    static int bar() { return 6; }
    +    int foobar() { return 7; }
     }
     
     ...
     
    -Foo f = new Foo;
    -Foo.bar();	// produces 6
    -Foo.foobar();	// error, no instance of Foo
    -f.bar();	// produces 6;
    -f.foobar();	// produces 7;
    +Foo f = new Foo;
    +Foo.bar();	// produces 6
    +Foo.foobar();	// error, no instance of Foo
    +f.bar();	// produces 6;
    +f.foobar();	// produces 7;
     
    - Static functions are never virtual. -

    - - Static data has only one instance for the entire program, +

    Static functions are never virtual. +

    +

    Static data has only one instance for the entire program, not once per object. -

    - - Static does not have the additional C meaning of being local +

    +

    Static does not have the additional C meaning of being local to a file. Use the private attribute in D to achieve that. For example: +

    -
    module foo;
    -int x = 3;		// x is global
    -private int y = 4;	// y is local to module foo
    +
    module foo;
    +int x = 3;		// x is global
    +private int y = 4;	// y is local to module foo
     

    Auto Attribute

    -
    -auto
    +
    auto
     
    - - The auto attribute is used for local variables and for class +

    The auto attribute is used for local variables and for class declarations. For class declarations, the auto attribute creates an auto class. For local declarations, auto implements the RAII (Resource @@ -553,40 +507,35 @@ reference to it goes out of scope. The destructor is called even if the scope is exited via a thrown exception, thus auto is used to guarantee cleanup. -

    - - If there is more than one auto variable going out of scope +

    +

    If there is more than one auto variable going out of scope at the same point, then the destructors are called in the reverse order that the variables were constructed. -

    - - Auto cannot be applied to globals, statics, data members, inout +

    +

    Auto cannot be applied to globals, statics, data members, inout or out parameters. Arrays of autos are not allowed, and auto function return values are not allowed. Assignment to an auto, other than initialization, is not allowed. Rationale: These restrictions may get relaxed in the future if a compelling reason to appears. - +

    Abstract Attribute

    - If a class is abstract, it cannot be instantiated +

    If a class is abstract, it cannot be instantiated directly. It can only be instantiated as a base class of another, non-abstract, class. -

    - - Classes become abstract if they are defined within an +

    +

    Classes become abstract if they are defined within an abstract attribute, or if any of the virtual member functions within it are declared as abstract. -

    - - Non-virtual functions cannot be declared as abstract. -

    - - Functions declared as abstract can still have function +

    +

    Non-virtual functions cannot be declared as abstract. +

    +

    Functions declared as abstract can still have function bodies. This is so that even though they must be overridden, they can still provide 'base class functionality.' - +

    diff -uNr dmd-0.156/dmd/html/d/builtin.html dmd-0.157/dmd/html/d/builtin.html --- dmd-0.156/dmd/html/d/builtin.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/builtin.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,28 +57,20 @@ · D vs C/C++/C#/Java
    - · Rationale for Builtins
    - · Converting C to D
    - · Converting C++ to D
    - · The C Preprocessor vs D
    - · D strings vs C++ std::string
    - · D complex vs C++ std::complex
    - · D Contract Programming vs C++
    -
    @@ -209,14 +201,14 @@ int value is naturally written as: -
    int[T] foo;
    +
    int[T] foo;
     
    rather than: -
    import std.associativeArray;
    +
    import std.associativeArray;
     ...
    -std.associativeArray.AA!(T, int) foo;
    +std.associativeArray.AA!(T, int) foo;
     
    Builtin associative arrays also offer the possibility of having @@ -238,7 +230,7 @@ far preferable than writing: -
    c = (complex!(double)(6,2) + complex!(double)(-1,3)) / complex!(double)(0,3);
    +
    c = (complex!(double)(6,2) + complex!(double)(-1,3)) / complex!(double)(0,3);
     
    ? It's no contest. diff -uNr dmd-0.156/dmd/html/d/changelog.html dmd-0.157/dmd/html/d/changelog.html --- dmd-0.156/dmd/html/d/changelog.html 2006-04-28 00:12:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/changelog.html 2006-05-10 11:39:36.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Fri Apr 28 00:12:31 2006 +
    Last update Wed May 10 11:39:33 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -173,8 +142,7 @@ A class declaration is defined: -
    -ClassDeclaration:
    +
    ClassDeclaration:
     	class Identifier BaseClassListopt ClassBody
     
     BaseClassList:
    @@ -221,7 +189,6 @@
     	ClassDeallocator
     
    - Classes consist of:
    @@ -249,7 +216,7 @@ A class is defined: -
    class Foo
    +
    class Foo
     {
         ... members ...
     }
    @@ -259,12 +226,12 @@
     	definition.
     	It is also not possible to declare a variable var like:
     
    -
    class Foo { } var;
    +
    class Foo { } var;
     
    Instead: -
    class Foo { }
    +
    class Foo { }
     Foo var;
     
    @@ -296,17 +263,17 @@ type of the class, not expressions which produce the type of the field itself: -
    class Foo
    +
    class Foo
     {
    -    int x;
    +    int x;
     }
     ...
    -void test(Foo foo)
    +void test(Foo foo)
     {
         size_t o;
     
    -    o = Foo.x.offsetof;   // yields 8
    -    o = foo.x.offsetof;   // error, .offsetof an int type
    +    o = Foo.x.offsetof;   // yields 8
    +    o = foo.x.offsetof;   // error, .offsetof an int type
     }
     
    @@ -318,12 +285,10 @@

    Constructors

    -
    -Constructor:
    +
    Constructor:
     	this Parameters FunctionBody
     
    - Members are always initialized to the default initializer for their type, which is usually 0 for integer types and NAN for floating point types. @@ -334,11 +299,11 @@ there can be a static initializer to be used instead of the default: -
    class Abc
    +
    class Abc
     {
    -    int a;	// default initializer for a is 0
    -    long b = 7;	// default initializer for b is 7
    -    float f;	// default initializer for f is NAN
    +    int a;	// default initializer for a is 0
    +    long b = 7;	// default initializer for b is 7
    +    float f;	// default initializer for f is NAN
     }
     
    @@ -349,12 +314,12 @@ Constructors are defined with a function name of this and having no return value: -
    class Foo
    +
    class Foo
     {
    -    this(int x)		// declare constructor for Foo
    +    this(int x)		// declare constructor for Foo
         {   ...
         }
    -    this()
    +    this()
         {   ...
         }
     }
    @@ -363,15 +328,15 @@
     	Base class construction is done by calling the base class
     	constructor by the name super:
     
    -
    class A { this(int y) { } }
    +
    class A { this(int y) { } }
     
    -class B : A
    +class B : A
     {
    -    int j;
    -    this()
    +    int j;
    +    this()
         {
     	...
    -	super(3);	// call base constructor A.this(3)
    +	super(3);	// call base constructor A.this(3)
     	...
         }
     }
    @@ -380,16 +345,16 @@
     	Constructors can also call other constructors for the same class
     	in order to share common initializations:
     
    -
    class C
    +
    class C
     {
    -    int j;
    -    this()
    +    int j;
    +    this()
         {
     	...
         }
    -    this(int i)
    +    this(int i)
         {
    -	this();
    +	this();
     	j = i;
         }
     }
    @@ -403,7 +368,7 @@
     	If there is no constructor for a class, but there is a constructor
     	for the base class, a default constructor of the form:
     
    -
    this() { }
    +
    this() { }
     
    is implicitly generated. @@ -414,23 +379,23 @@
    1. It is illegal for constructors to mutually call each other: -
      this() { this(1); }
      -this(int i) { this(); }	// illegal, cyclic constructor calls
      +
      this() { this(1); }
      +this(int i) { this(); }	// illegal, cyclic constructor calls
       
    2. If any constructor call appears inside a constructor, any path through the constructor must make exactly one constructor call: -
      this()	{ a || super(); }	// illegal
      +
      this()	{ a || super(); }	// illegal
       
      -this() { this(1) || super(); }	// ok
      +this() { this(1) || super(); }	// ok
       
      -this()
      +this()
       {
      -    for (...)
      +    for (...)
           {
      -	super();	// illegal, inside loop
      +	super();	// illegal, inside loop
           }
       }
       
      @@ -443,7 +408,7 @@ Instances of class objects are created with NewExpressions: -
      A a = new A(3);
      +
      A a = new A(3);
       
      The following steps happen: @@ -474,19 +439,17 @@

      Destructors

      -
      -Destructor:
      +
      Destructor:
       	~this() FunctionBody
       
      - The garbage collector calls the destructor function when the object is deleted. The syntax is: -
      class Foo
      +
      class Foo
       {
      -	~this()		// destructor for Foo
      +	~this()		// destructor for Foo
       	{
       	}
       }
      @@ -532,12 +495,10 @@
       
       

      Static Constructors

      -
      -StaticConstructor:
      +
      StaticConstructor:
       	static this() FunctionBody
       
      - A static constructor is defined as a function that performs initializations before the main() function gets control. Static constructors are used to @@ -552,10 +513,10 @@ this stems from not having good control over exactly when the code is executed, for example: -
      class Foo
      +
      class Foo
       {
      -    static int a = b + 1;
      -    static int b = a * 2;
      +    static int a = b + 1;
      +    static int b = a * 2;
       }
       
      @@ -577,16 +538,16 @@ initialization is performed by a static constructor, defined with a special syntax static this(). -
      class Foo
      +
      class Foo
       {
      -    static int a;		// default initialized to 0
      -    static int b = 1;
      -    static int c = b + a;	// error, not a constant initializer
      +    static int a;		// default initialized to 0
      +    static int b = 1;
      +    static int c = b + a;	// error, not a constant initializer
       
      -    static this()		// static constructor
      +    static this()		// static constructor
           {
      -	a = b + 1;		// a is set to 2
      -	b = a * 2;		// b is set to 4
      +	a = b + 1;		// a is set to 2
      +	b = a * 2;		// b is set to 4
           }
       }
       
      @@ -609,33 +570,31 @@ The static in the static constructor declaration is not an attribute, it must appear immediately before the this: -
      class Foo
      +
      class Foo
       {
      -    static this() { ... }	// a static constructor
      -    static private this() { ... } // not a static constructor
      -    static
      +    static this() { ... }	// a static constructor
      +    static private this() { ... } // not a static constructor
      +    static
           {
      -	this() { ... }		// not a static constructor
      +	this() { ... }		// not a static constructor
           }
      -    static:
      -	this() { ... }		// not a static constructor
      +    static:
      +	this() { ... }		// not a static constructor
       }
       

      Static Destructor

      -
      -StaticDestructor:
      +
      StaticDestructor:
       	static ~this() FunctionBody
       
      - A static destructor is defined as a special static function with the syntax static ~this(). -
      class Foo
      +
      class Foo
       {
      -    static ~this()		// static destructor
      +    static ~this()		// static destructor
           {
           }
       }
      @@ -652,27 +611,25 @@
       	The static in the static denstructor declaration is not
       	an attribute, it must appear immediately before the ~this:
       
      -
      class Foo
      +
      class Foo
       {
      -    static ~this() { ... }	// a static destructor
      -    static private ~this() { ... } // not a static destructor
      -    static
      +    static ~this() { ... }	// a static destructor
      +    static private ~this() { ... } // not a static destructor
      +    static
           {
      -	~this() { ... }		// not a static destructor
      +	~this() { ... }		// not a static destructor
           }
      -    static:
      -	~this() { ... }		// not a static destructor
      +    static:
      +	~this() { ... }		// not a static destructor
       }
       

      Class Invariants

      -
      -ClassInvariant:
      +
      ClassInvariant:
       	invariant FunctionBody
       
      - Class invariants are used to specify characteristics of a class that always must be true (except while executing a member function). For example, a class representing a date might have an invariant that the day must be 1..31 @@ -680,15 +637,15 @@ -
      class Date
      +
      class Date
       {
      -    int day;
      -    int hour;
      +    int day;
      +    int hour;
       
      -    invariant
      +    invariant
           {
      -	assert(1 <= day && day <= 31);
      -	assert(0 <= hour && hour < 24);
      +	assert(1 <= day && day <= 31);
      +	assert(0 <= hour && hour < 24);
           }
       }
       
      @@ -706,15 +663,15 @@ Doing so will result in a stack overflow, as the invariant will wind up being called in an infinitely recursive manner. -
      class Foo
      +
      class Foo
       {
      -    public void f() { }
      -    private void g() { }
      +    public void f() { }
      +    private void g() { }
       
      -    invariant
      +    invariant
           {
      -	f();  // error, cannot call public member function from invariant
      -	g();  // ok, g() is not public
      +	f();  // error, cannot call public member function from invariant
      +	g();  // ok, g() is not public
           }
       }
       
      @@ -725,7 +682,7 @@
      Date mydate;
       ...
      -assert(mydate);		// check that class Date invariant holds
      +assert(mydate);		// check that class Date invariant holds
       
      If the invariant fails, it throws an InvariantException. @@ -741,12 +698,10 @@

      Unit Tests

      -
      -UnitTest:
      +
      UnitTest:
       	unittest FunctionBody
       
      - Unit tests are a series of test cases applied to a class to determine if it is working properly. Ideally, unit tests should be run every time a program is compiled. The best way to make sure that unit @@ -757,7 +712,7 @@ Classes can have a special member function called: -
      unittest
      +
      unittest
       {
           ...test code...
       }
      @@ -772,30 +727,28 @@
       
       	For example, given a class Sum that is used to add two values:
       
      -
      class Sum
      +
      class Sum
       {
      -    int add(int x, int y) { return x + y; }
      +    int add(int x, int y) { return x + y; }
       
      -    unittest
      +    unittest
           {
      -	Sum sum = new Sum;
      -	assert(sum.add(3,4) == 7);
      -	assert(sum.add(-2,0) == -2);
      +	Sum sum = new Sum;
      +	assert(sum.add(3,4) == 7);
      +	assert(sum.add(-2,0) == -2);
           }
       }
       

      Class Allocators

      -
      -ClassAllocator:
      +
      ClassAllocator:
       	new Parameters FunctionBody
       
      - A class member function of the form: -
      new(uint size)
      +
      new(uint size)
       {
           ...
       }
      @@ -808,7 +761,7 @@
       	determined by the usual function overloading rules.
       	When a new expression:
       
      -
      new Foo;
      +
      new Foo;
       
      is executed, and Foo is a class that has @@ -823,11 +776,11 @@ additional arguments are specified within parentheses after the new in the NewExpression: -
      class Foo
      +
      class Foo
       {
      -    this(char[] a) { ... }
      +    this(char[] a) { ... }
       
      -    new(uint size, int x, int y)
      +    new(uint size, int x, int y)
           {
       	...
           }
      @@ -835,7 +788,7 @@
       
       ...
       
      -new(1,2) Foo(a);	// calls new(Foo.sizeof,1,2)
      +new(1,2) Foo(a);	// calls new(Foo.sizeof,1,2)
       
      Derived classes inherit any allocator from their base class, @@ -846,15 +799,13 @@

      Class Deallocators

      -
      -ClassDeallocator:
      +
      ClassDeallocator:
       	delete Parameters FunctionBody
       
      - A class member function of the form: -
      delete(void *p)
      +
      delete(void *p)
       {
           ...
       }
      @@ -865,7 +816,7 @@
       	Only one can be specified for a class.
       	When a delete expression:
       
      -
      delete f;
      +
      delete f;
       
      is executed, and f is a reference to a class instance that has @@ -885,7 +836,7 @@ An auto class is a class with the auto attribute, as in: -
      auto class Foo { ... }
      +
      auto class Foo { ... }
       
      The auto characteristic is inherited, so if any classes derived @@ -895,12 +846,12 @@ An auto class reference can only appear as a function local variable. It must be declared as being auto: -
      auto class Foo { ... }
      +
      auto class Foo { ... }
       
      -void func()
      +void func()
       {
      -    Foo f;	// error, reference to auto class must be auto
      -    auto Foo g = new Foo();	// correct
      +    Foo f;	// error, reference to auto class must be auto
      +    auto Foo g = new Foo();	// correct
       }
       
      @@ -915,27 +866,27 @@ A nested class has access to the variables and other symbols of the classes and functions it is nested inside: -
      class Outer
      +
      class Outer
       {
      -    int m;
      +    int m;
       
      -    class Inner
      +    class Inner
           {
      -	int foo()
      +	int foo()
       	{
      -	    return m;	// Ok to access member of Outer
      +	    return m;	// Ok to access member of Outer
       	}
           }
       }
       
      -void func()
      -{   int m;
      +void func()
      +{   int m;
       
      -    class Inner
      +    class Inner
           {
      -	int foo()
      +	int foo()
       	{
      -	    return m;	// Ok to access local variable m of func()
      +	    return m;	// Ok to access local variable m of func()
       	}
           }
       }
      @@ -945,31 +896,31 @@
       	not access variables of the enclosing scope that are local to the
       	stack or need a this:
       
      -
      class Outer
      +
      class Outer
       {
      -    int m;
      -    static int n;
      +    int m;
      +    static int n;
       
      -    static class Inner
      +    static class Inner
           {
      -	int foo()
      +	int foo()
       	{
      -	    return m;	// Error, Inner is static and m needs a this
      -	    return n;	// Ok, n is static
      +	    return m;	// Error, Inner is static and m needs a this
      +	    return n;	// Ok, n is static
       	}
           }
       }
       
      -void func()
      -{   int m;
      -    static int n;
      +void func()
      +{   int m;
      +    static int n;
       
      -    static class Inner
      +    static class Inner
           {
      -	int foo()
      +	int foo()
       	{
      -	    return m;	// Error, Inner is static and m is local to the stack
      -	    return n;	// Ok, n is static
      +	    return m;	// Error, Inner is static and m is local to the stack
      +	    return n;	// Ok, n is static
       	}
           }
       }
      @@ -988,22 +939,22 @@
       	A non-static nested class can only be instantiated when the necessary
       	context pointer information is available:
       
      -
      class Outer
      +
      class Outer
       {
      -    class Inner { }
      +    class Inner { }
       
      -    static class SInner { }
      +    static class SInner { }
       }
       
      -void func()
      +void func()
       {
      -    class Nested { }
      +    class Nested { }
       
      -    Outer o = new Outer;	// Ok
      -    Outer.Inner oi = new Outer.Inner;	// Error, no 'this' for Outer
      -    Outer.SInner os = new Outer.SInner;	// Ok
      +    Outer o = new Outer;	// Ok
      +    Outer.Inner oi = new Outer.Inner;	// Error, no 'this' for Outer
      +    Outer.SInner os = new Outer.SInner;	// Ok
       
      -    Nested n = new Nested;	// Ok
      +    Nested n = new Nested;	// Ok
       }
       
      @@ -1011,29 +962,29 @@ of its enclosing function, that access becomes invalid once the enclosing function exits: -
      class Base
      +
      class Base
       {
      -    int foo() { return 1; }
      +    int foo() { return 1; }
       }
       
       Base func()
      -{   int m = 3;
      +{   int m = 3;
       
      -    class Nested : Base
      +    class Nested : Base
           {
      -	int foo() { return m; }
      +	int foo() { return m; }
           }
       
      -    Base b = new Nested;
      +    Base b = new Nested;
       
      -    assert(b.foo() == 3);	// Ok, func() is still active
      -    return b;
      +    assert(b.foo() == 3);	// Ok, func() is still active
      +    return b;
       }
       
      -int test()
      +int test()
       {
           Base b = func();
      -    return b.foo();		// Error, func().m is undefined
      +    return b.foo();		// Error, func().m is undefined
       }
       
      @@ -1041,31 +992,31 @@ is to make copies of the needed variables within the nested class's constructor: -
      class Base
      +
      class Base
       {
      -    int foo() { return 1; }
      +    int foo() { return 1; }
       }
       
       Base func()
      -{   int m = 3;
      +{   int m = 3;
       
      -    class Nested : Base
      -    {   int m_;
      +    class Nested : Base
      +    {   int m_;
       
      -	this() { m_ = m;
      -	int foo() { return m_; }
      +	this() { m_ = m;
      +	int foo() { return m_; }
           }
       
      -    Base b = new Nested;
      +    Base b = new Nested;
       
      -    assert(b.foo() == 3);	// Ok, func() is still active
      -    return b;
      +    assert(b.foo() == 3);	// Ok, func() is still active
      +    return b;
       }
       
      -int test()
      +int test()
       {
           Base b = func();
      -    return b.foo();		// Ok, using cached copy of func().m
      +    return b.foo();		// Ok, using cached copy of func().m
       }
       
      @@ -1074,18 +1025,16 @@ An anonymous nested class is both defined and instantiated with a NewAnonClassExpression: -
      -NewAnonClassExpression:
      +
      NewAnonClassExpression:
           new ()ArgumentListopt class ()ArgumentListopt SuperClassopt InterfaceClassesopt ClassBody
       
      - which is equivalent to: -
      class Identifier : SuperClass InterfaceClasses
      +
      class Identifier : SuperClass InterfaceClasses
       	ClassBody
       
      -new (ArgumentList) Identifier (ArgumentList);
      +new (ArgumentList) Identifier (ArgumentList);
       
      where Identifier is the name generated for the anonymous diff -uNr dmd-0.156/dmd/html/d/code_coverage.html dmd-0.157/dmd/html/d/code_coverage.html --- dmd-0.156/dmd/html/d/code_coverage.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/code_coverage.html 2006-05-08 15:25:44.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
      Last update Wed Apr 26 22:34:31 2006 +
      Last update Mon May 8 15:25:43 2006
      @@ -56,131 +56,94 @@ · Overview
      - · D for Win32
      - · Win32 DLLs in D
      - · C .h to D Modules
      - · FAQ
      - · Style Guide
      - · Example: wc
      - · Future
      - · D Change Log
      - · Tech Tips
      - · Rationale
      - · Warnings
      -
      Articles
      · Exception Safety
      - · Templates Revisited
      -
      Tools
      · DMD D Compiler
      - · GDC D Compiler
      - · Linker
      - · Profiler
      - · Code Coverage
      - · DMD Script Shell
      - · Windows Debugger
      -
      Community
      · News
      - · Forum
      - · Announcements
      - · Learn
      - · D links
      -
      Archives
      · digitalmars.D
      - · digitalmars.D.dtl
      - · digitalmars.D.announce
      - · digitalmars.D.dwt
      - · digitalmars.D.learn
      - · digitalmars.D.bugs
      - · D.gnu
      - · Old D
      -
      Appendices
      · Glossary
      - · Ascii Table
      - · Acknowledgements
      -

    D + vs Other Languages

    -
    - To D, or not to D. -- Willeam NerdSpeare +
    To D, or not to D. -- Willeam NerdSpeare
    + This table is a quick and rough comparison of various features of D + with other languages it is frequently compared with. While many capabilities are available with standard libraries, this table is for features built in to the core language itself. @@ -108,6 +102,7 @@
    Feature D + C C++ diff -uNr dmd-0.156/dmd/html/d/cppcomplex.html dmd-0.157/dmd/html/d/cppcomplex.html --- dmd-0.156/dmd/html/d/cppcomplex.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/cppcomplex.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,28 +57,20 @@ · D vs C/C++/C#/Java
    - · Rationale for Builtins
    - · Converting C to D
    - · Converting C++ to D
    - · The C Preprocessor vs D
    - · D strings vs C++ std::string
    - · D complex vs C++ std::complex
    - · D Contract Programming vs C++
    -
    @@ -99,12 +91,12 @@ C++ has no distinct imaginary type. D has 3 complex types and 3 imaginary types: -
    cfloat
    -cdouble
    -creal
    -ifloat
    -idouble
    -ireal
    +
    cfloat
    +cdouble
    +creal
    +ifloat
    +idouble
    +ireal
     
    A C++ complex number can interact with an arithmetic literal, but @@ -119,9 +111,9 @@ In D, an imaginary numeric literal has the 'i' suffix. The corresponding code would be the more natural: -
    creal a = 5;		// a = 5 + 0i
    -ireal b = 7i;		// b = 7i
    -c = a + b + 7i;		// c = 5 + 14i
    +
    creal a = 5;		// a = 5 + 0i
    +ireal b = 7i;		// b = 7i
    +c = a + b + 7i;		// c = 5 + 14i
     
    For more involved expressions involving constants: @@ -150,7 +142,7 @@ on the 0 real part. For example, adding two imaginary numbers in D is one add: -
    ireal a, b, c;
    +
    ireal a, b, c;
     c = a + b;
     
    @@ -190,8 +182,8 @@ To avoid these efficiency concerns in C++, one could simulate an imaginary number using a double. For example, given the D: -
    cdouble c;
    -idouble im;
    +
    cdouble c;
    +idouble im;
     c *= im;
     
    @@ -226,6 +218,7 @@ Arithmetic; it needs the Imaginary type." + The semantic problems are:
    @@ -162,19 +154,19 @@ Consider a class invariant in D: -
    class A
    +
    class A
     {
    -    invariant() { ...contracts... }
    +    invariant() { ...contracts... }
     
    -    this() { ... }	// constructor
    -    ~this() { ... }	// destructor
    +    this() { ... }	// constructor
    +    ~this() { ... }	// destructor
     
    -    void foo() { ... }	// public member function
    +    void foo() { ... }	// public member function
     }
     
    -class B : A
    +class B : A
     {
    -    invariant() { ...contracts... }
    +    invariant() { ...contracts... }
         ...
     }
     
    @@ -292,10 +284,10 @@ Consider the following in D: -
    void foo()
    -    in { ...preconditions... }
    -    out { ...postconditions... }
    -    body
    +
    void foo()
    +    in { ...preconditions... }
    +    out { ...postconditions... }
    +    body
         {
     	...implementation...
         }
    @@ -344,15 +336,15 @@
     	Let's add a return value to foo() that needs to be checked in
     	the postconditions. In D:
     
    -
    int foo()
    -    in { ...preconditions... }
    -    out (result) { ...postconditions... }
    -    body
    +
    int foo()
    +    in { ...preconditions... }
    +    out (result) { ...postconditions... }
    +    body
         {
     	...implementation...
    -	if (...)
    -	    return bar();
    -	return 3;
    +	if (...)
    +	    return bar();
    +	return 3;
         }
     
    @@ -384,15 +376,15 @@ Now add a couple parameters to foo(). In D: -
    int foo(int a, int b)
    -    in { ...preconditions... }
    -    out (result) { ...postconditions... }
    -    body
    +
    int foo(int a, int b)
    +    in { ...preconditions... }
    +    out (result) { ...postconditions... }
    +    body
         {
     	...implementation...
    -	if (...)
    -	    return bar();
    -	return 3;
    +	if (...)
    +	    return bar();
    +	return 3;
         }
     
    @@ -432,23 +424,23 @@ Consider the use of preconditions and postconditions for a polymorphic function in D: -
    class A
    +
    class A
     {
    -    void foo()
    -	in { ...Apreconditions... }
    -	out { ...Apostconditions... }
    -	body
    +    void foo()
    +	in { ...Apreconditions... }
    +	out { ...Apostconditions... }
    +	body
     	{
     	    ...implementation...
     	}
     }
     
    -class B : A
    +class B : A
     {
    -    void foo()
    -	in { ...Bpreconditions... }
    -	out { ...Bpostconditions... }
    -	body
    +    void foo()
    +	in { ...Bpreconditions... }
    +	out { ...Bpostconditions... }
    +	body
     	{
     	    ...implementation...
     	}
    diff -uNr dmd-0.156/dmd/html/d/cppstrings.html dmd-0.157/dmd/html/d/cppstrings.html
    --- dmd-0.156/dmd/html/d/cppstrings.html	2006-04-26 22:34:30.000000000 +0200
    +++ dmd-0.157/dmd/html/d/cppstrings.html	2006-05-08 17:32:04.000000000 +0200
    @@ -26,7 +26,7 @@
     
     " title="Read/write comments and feedback">Comments
     
    -	
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 17:32:03 2006
    @@ -58,28 +58,20 @@ · D vs C/C++/C#/Java
    - · Rationale for Builtins
    - · Converting C to D
    - · Converting C++ to D
    - · The C Preprocessor vs D
    - · D strings vs C++ std::string
    - · D complex vs C++ std::complex
    - · D Contract Programming vs C++
    -
    @@ -92,19 +84,17 @@

    Concatenation Operator

    - C++ Strings are stuck with overloading existing operators. The +

    C++ Strings are stuck with overloading existing operators. The obvious choice for concatenation is += and +. But someone just looking at the code will see + and think "addition". He'll have to look up the types (and types are frequently buried behind multiple typedef's) to see that it's a string type, and it's not adding strings but concatenating them. -

    - - Additionally, if one has an array of floats, is '+' overloaded to +

    +

    Additionally, if one has an array of floats, is '+' overloaded to be the same as a vector addition, or an array concatenation? -

    - - In D, these problems are avoided by introducing a new binary +

    +

    In D, these problems are avoided by introducing a new binary operator ~ as the concatenation operator. It works with arrays (of which strings are a subset). ~= is the corresponding append operator. ~ on arrays of floats would concatenate them, @@ -112,166 +102,188 @@ for orthogonality and consistency in the treatment of arrays. (In D, strings are simply arrays of characters, not a special type.) +

    Interoperability With C String Syntax

    - Overloading of operators only really works if one of the operands +

    Overloading of operators only really works if one of the operands is overloadable. So the C++ string class cannot consistently handle arbitrary expressions containing strings. Consider: +

    -
            const char abc[5] = "world";
    -        string str = "hello" + abc;
    +
    const char abc[5] = "world";
    +string str = "hello" + abc;
     
    - That isn't going to work. But it does work when the core language +

    That isn't going to work. But it does work when the core language knows about strings: +

    -
    	const char[5] abc = "world";
    -	char[] str = "hello" ~ abc;
    +
    const char[5] abc = "world";
    +char[] str = "hello" ~ abc;
     

    Consistency With C String Syntax

    - There are three ways to find the length of a string in C++: +

    There are three ways to find the length of a string in C++: +

    -
    	const char abc[] = "world";	:	sizeof(abc)/sizeof(abc[0])-1
    -					:	strlen(abc)
    -	string str			:	str.length()
    +
    const char abc[] = "world";	:	sizeof(abc)/sizeof(abc[0])-1
    +				:	strlen(abc)
    +string str			:	str.length()
     
    - That kind of inconsistency makes it hard to write generic templates. +

    That kind of inconsistency makes it hard to write generic templates. Consider D: +

    -
    	char[5] abc = "world";	:	abc.length
    -	char[] str		:	str.length
    +
    char[5] abc = "world";	:	abc.length
    +char[] str		:	str.length
     

    Checking For Empty Strings

    - C++ strings use a function to determine if a string is empty: +

    C++ strings use a function to determine if a string is empty: +

    -
    	string str;
    -	if (str.empty())
    -		// string is empty
    +
    string str;
    +if (str.empty())
    +	// string is empty
     
    - In D, an empty string has zero length: +

    In D, an empty string has zero length: +

    -
    	char[] str;
    -	if (!str.length)
    -		// string is empty
    +
    char[] str;
    +if (!str.length)
    +	// string is empty
     

    Resizing Existing String

    - C++ handles this with the resize() member function: +

    C++ handles this with the resize() member function: +

    -
    	string str;
    -	str.resize(newsize);
    +
    string str;
    +str.resize(newsize);
     
    - D takes advantage of knowing that str is a string, and +

    D takes advantage of knowing that str is a string, and so resizing it is just changing the length property: +

    -
    	char[] str;
    -	str.length = newsize;
    +
    char[] str;
    +str.length = newsize;
     

    Slicing a String

    - C++ slices an existing string using a special constructor: +

    C++ slices an existing string using a special constructor: +

    -
    	string s1 = "hello world";
    -	string s2(s1, 6, 5);		// s2 is "world"
    +
    string s1 = "hello world";
    +string s2(s1, 6, 5);		// s2 is "world"
     
    - D has the array slice syntax, not possible with C++: +

    D has the array slice syntax, not possible with C++: +

    -
    	char[] s1 = "hello world";
    -	char[] s2 = s1[6 .. 11];	// s2 is "world"
    +
    char[] s1 = "hello world";
    +char[] s2 = s1[6 .. 11];	// s2 is "world"
     
    - Slicing, of course, works with any array in D, not just strings. +

    Slicing, of course, works with any array in D, not just strings. +

    Copying a String

    - C++ copies strings with the replace function: +

    C++ copies strings with the replace function: +

    -
    	string s1 = "hello world";
    -	string s2 = "goodbye      ";
    -	s2.replace(8, 5, s1, 6, 5);	// s2 is "goodbye world"
    +
    string s1 = "hello world";
    +string s2 = "goodbye      ";
    +s2.replace(8, 5, s1, 6, 5);	// s2 is "goodbye world"
     
    - D uses the slice syntax as an lvalue: +

    D uses the slice syntax as an lvalue: +

    -
    	char[] s1 = "hello world";
    -	char[] s2 = "goodbye      ";
    -	s2[8..13] = s1[6..11];		// s2 is "goodbye world"
    +
    char[] s1 = "hello world";
    +char[] s2 = "goodbye      ";
    +s2[8..13] = s1[6..11];		// s2 is "goodbye world"
     

    Conversions to C Strings

    - This is needed for compatibility with C API's. In C++, this +

    This is needed for compatibility with C API's. In C++, this uses the c_str() member function: +

    -
    	void foo(const char *);
    -	string s1;
    -	foo(s1.c_str());
    +
    void foo(const char *);
    +string s1;
    +foo(s1.c_str());
     
    - In D, strings can be implicitly converted to char*: +

    In D, strings can be implicitly converted to char*: +

    -
    	void foo(char *);
    -	char[] s1;
    -	foo(s1);
    +
    void foo(char *);
    +char[] s1;
    +foo(s1);
     
    - Note: some will argue that it is a mistake in D to have an implicit +

    Note: some will argue that it is a mistake in D to have an implicit conversion from char[] to char*. +

    Array Bounds Checking

    - In C++, string array bounds checking for [] is not done. +

    In C++, string array bounds checking for [] is not done. In D, array bounds checking is on by default and it can be turned off with a compiler switch after the program is debugged. +

    String Switch Statements

    - Are not possible in C++, nor is there any way to add them +

    Are not possible in C++, nor is there any way to add them by adding more to the library. In D, they take the obvious syntactical forms: +

    -
    	switch (str)
    -	{
    -	    case "hello":
    -	    case "world":
    -		...
    -	}
    +
    switch (str)
    +{
    +    case "hello":
    +    case "world":
    +	...
    +}
     
    - where str can be any of literal "string"s, fixed string arrays +

    where str can be any of literal "string"s, fixed string arrays like char[10], or dynamic strings like char[]. A quality implementation can, of course, explore many strategies of efficiently implementing this based on the contents of the case strings. +

    Filling a String

    - In C++, this is done with the replace() member function: +

    In C++, this is done with the replace() member function: +

    -
    	string str = "hello";
    -	str.replace(1,2,2,'?');		// str is "h??lo"
    +
    string str = "hello";
    +str.replace(1,2,2,'?');		// str is "h??lo"
     
    - In D, use the array slicing syntax in the natural manner: +

    In D, use the array slicing syntax in the natural manner: +

    -
    	char[] str = "hello";
    -	str[1..3] = '?';		// str is "h??lo"
    +
    char[] str = "hello";
    +str[1..3] = '?';		// str is "h??lo"
     

    Value vs Reference

    - C++ strings, as implemented by STLport, are by value and are +

    C++ strings, as implemented by STLport, are by value and are 0-terminated. [The latter is an implementation choice, but STLport seems to be the most popular implementation.] This, coupled with no garbage collection, has @@ -285,107 +297,112 @@ implies that strings cannot refer to other strings. String data in the data segment, stack, etc., cannot be referred to. -

    +

    - D strings are reference types, and the memory is garbage collected. +

    D strings are reference types, and the memory is garbage collected. This means that only references need to be copied, not the string data. D strings can refer to data in the static data segment, data on the stack, data inside other strings, objects, file buffers, etc. There's no need to keep track of the 'owner' of the string data. -

    +

    - The obvious question is if multiple D strings refer to the same +

    The obvious question is if multiple D strings refer to the same string data, what happens if the data is modified? All the references will now point to the modified data. This can have its own consequences, which can be avoided if the copy-on-write convention is followed. All copy-on-write is is that if a string is written to, an actual copy of the string data is made first. -

    +

    - The result of D strings being reference only and garbage collected +

    The result of D strings being reference only and garbage collected is that code that does a lot of string manipulating, such as an lzw compressor, can be a lot more efficient in terms of both memory consumption and speed. +

    Benchmark

    - Let's take a look at a small utility, wordcount, that counts up +

    Let's take a look at a small utility, wordcount, that counts up the frequency of each word in a text file. In D, it looks like this: +

    -
    import file;
    +
    import file;
     
    -int main (char[][] args)
    +int main (char[][] args)
     {
    -    int w_total;
    -    int l_total;
    -    int c_total;
    -    int[char[]] dictionary;
    +    int w_total;
    +    int l_total;
    +    int c_total;
    +    int[char[]] dictionary;
     
    -    printf("   lines   words   bytes file\n");
    -    for (int i = 1; i < args.length; ++i)
    +    printf("   lines   words   bytes file\n");
    +    for (int i = 1; i < args.length; ++i)
         {
    -	char[] input;
    -	int w_cnt, l_cnt, c_cnt;
    -	int inword;
    -	int wstart;
    +	char[] input;
    +	int w_cnt, l_cnt, c_cnt;
    +	int inword;
    +	int wstart;
     
    -	input = cast(char[])file.read(args[i]);
    +	input = cast(char[])file.read(args[i]);
     
    -	for (int j = 0; j < input.length; j++)
    -	{   char c;
    +	for (int j = 0; j < input.length; j++)
    +	{   char c;
     
     	    c = input[j];
    -	    if (c == '\n')
    +	    if (c == '\n')
     		++l_cnt;
    -	    if (c >= '0' && c <= '9')
    +	    if (c >= '0' && c <= '9')
     	    {
     	    }
    -	    else if (c >= 'a' && c <= 'z' ||
    +	    else if (c >= 'a' && c <= 'z' ||
     		c >= 'A' && c <= 'Z')
     	    {
    -		if (!inword)
    +		if (!inword)
     		{
     		    wstart = j;
     		    inword = 1;
     		    ++w_cnt;
     		}
     	    }
    -	    else if (inword)
    -	    {   char[] word = input[wstart .. j];
    +	    else if (inword)
    +	    {   char[] word = input[wstart .. j];
     
     		dictionary[word]++;
     		inword = 0;
     	    }
     	    ++c_cnt;
     	}
    -	if (inword)
    -	{   char[] w = input[wstart .. input.length];
    +	if (inword)
    +	{   char[] w = input[wstart .. input.length];
     	    dictionary[w]++;
     	}
    -	printf("%8lu%8lu%8lu %.*s\n", l_cnt, w_cnt, c_cnt, args[i]);
    +	printf("%8lu%8lu%8lu %.*s\n", l_cnt, w_cnt, c_cnt, args[i]);
     	l_total += l_cnt;
     	w_total += w_cnt;
     	c_total += c_cnt;
         }
     
    -    if (args.length > 2)
    +    if (args.length > 2)
         {
    -	printf("--------------------------------------\n%8lu%8lu%8lu total",
    +	printf("--------------------------------------\n%8lu%8lu%8lu total",
     	    l_total, w_total, c_total);
         }
     
    -    printf("--------------------------------------\n");
    +    printf("--------------------------------------\n");
     
    -    foreach (char[] word1; dictionary.keys.sort)
    +    foreach (char[] word1; dictionary.keys.sort)
         {
    -	printf("%3d %.*s\n", dictionary[word1], word1);
    +	printf("%3d %.*s\n", dictionary[word1], word1);
         }
    -    return 0;
    +    return 0;
     }
     
    +

    (An alternate implementation that + uses buffered file I/O to handle larger files.)

    +

    Two people have written C++ implementations using the C++ standard template library, wccpp1 @@ -406,31 +423,30 @@ implementation.

    - - - - - -
    Program - Compile - Compile Time - Run - Run Time -
    D wc - dmd wc -O -release - 0.0719 - wc alice30.txt >log - 0.0326 -
    C++ wccpp1 - dmc wccpp1 -o -I\dm\stlport\stlport - 2.1917 - wccpp1 alice30.txt >log - 0.0944 -
    C++ wccpp2 - dmc wccpp2 -o -I\dm\stlport\stlport - 2.0463 - wccpp2 alice30.txt >log - 0.1012 + + + + + + + + + + + + + + + + + + + + + + + +
    ProgramCompileCompile TimeRunRun Time
    D wcdmd wc -O -release0.0719wc alice30.txt >log0.0326
    C++ wccpp1dmc wccpp1 -o -I\dm\stlport\stlport2.1917wccpp1 alice30.txt >log0.0944
    C++ wccpp2dmc wccpp2 -o -I\dm\stlport\stlport2.0463wccpp2 alice30.txt >log0.1012

    The following tests were run on linux, again comparing a D compiler @@ -443,37 +459,36 @@

    - - - - - - -
    Program - Compile - Compile Time - Run - Run Time -
    D wc - gdc -O2 -frelease -o wc wc.d - 0.326 - wc alice30.txt > /dev/null - 0.041 -
    D wc - dmd wc -O -release - 0.235 - wc alice30.txt > /dev/null - 0.041 -
    C++ wccpp1 - g++ -O2 -o wccpp1 wccpp1.cc - 2.874 - wccpp1 alice30.txt > /dev/null - 0.086 -
    C++ wccpp2 - g++ -O2 -o wccpp2 wccpp2.cc - 2.886 - wccpp2 alice30.txt > /dev/null - 0.095 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ProgramCompileCompile TimeRunRun Time
    D wcgdc -O2 -frelease -o wc wc.d0.326wc alice30.txt > /dev/null0.041
    D wcdmd wc -O -release0.235wc alice30.txt > /dev/null0.041
    C++ wccpp1g++ -O2 -o wccpp1 wccpp1.cc2.874wccpp1 alice30.txt > /dev/null0.086
    C++ wccpp2g++ -O2 -o wccpp2 wccpp2.cc2.886wccpp2 alice30.txt > /dev/null0.095

    These tests compare gdc with g++ on a PowerMac G5 2x2.0GHz @@ -481,31 +496,30 @@ less accurate.)

    - - - - - - diff -uNr dmd-0.156/dmd/html/d/ddoc.html dmd-0.157/dmd/html/d/ddoc.html --- dmd-0.156/dmd/html/d/ddoc.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/ddoc.html 2006-05-08 15:25:44.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -56,97 +56,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -218,41 +181,41 @@ A DllMain() is required, looking like: -
    import std.c.windows.windows;
    +
    import std.c.windows.windows;
     HINSTANCE g_hInst;
     
    -extern (C)
    +extern (C)
     {
    -	void gc_init();
    -	void gc_term();
    -	void _minit();
    -	void _moduleCtor();
    -	void _moduleUnitTests();
    +	void gc_init();
    +	void gc_term();
    +	void _minit();
    +	void _moduleCtor();
    +	void _moduleUnitTests();
     }
     
    -extern (Windows)
    +extern (Windows)
     BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
     {
    -    switch (ulReason)
    +    switch (ulReason)
         {
    -	case DLL_PROCESS_ATTACH:
    -	    gc_init();			// initialize GC
    -	    _minit();			// initialize module list
    -	    _moduleCtor();		// run module constructors
    -	    _moduleUnitTests();		// run module unit tests
    -	    break;
    -
    -	case DLL_PROCESS_DETACH:
    -	    gc_term();			// shut down GC
    -	    break;
    -
    -	case DLL_THREAD_ATTACH:
    -	case DLL_THREAD_DETACH:
    -	    // Multiple threads not supported yet
    -	    return false;
    +	case DLL_PROCESS_ATTACH:
    +	    gc_init();			// initialize GC
    +	    _minit();			// initialize module list
    +	    _moduleCtor();		// run module constructors
    +	    _moduleUnitTests();		// run module unit tests
    +	    break;
    +
    +	case DLL_PROCESS_DETACH:
    +	    gc_term();			// shut down GC
    +	    break;
    +
    +	case DLL_THREAD_ATTACH:
    +	case DLL_THREAD_DETACH:
    +	    // Multiple threads not supported yet
    +	    return false;
         }
         g_hInst=hInstance;
    -    return true;
    +    return true;
     }
     
    @@ -291,8 +254,8 @@ which prints a string:

    mydll2.d:

    -
    module mydll;
    -export void dllprint() { printf("hello dll world\n"); }
    +
    module mydll;
    +export void dllprint() { printf("hello dll world\n"); }
     

    mydll.def:

    @@ -317,19 +280,19 @@ Now for a program, test.d, which will use the dll:

    test.d:

    -
    import mydll;
    +
    import mydll;
     
    -int main()
    +int main()
     {
        mydll.dllprint();
    -   return 0;
    +   return 0;
     }
     
    Create a clone of mydll2.d that doesn't have the function bodies:

    mydll.d:

    -
    export void dllprint();
    +
    export void dllprint();
     
    Compile and link with the command: @@ -411,11 +374,11 @@ So, to write a COM object: -
    import std.c.windows.com;
    +
    import std.c.windows.com;
     
    -class MyCOMobject : ComObject
    +class MyCOMobject : ComObject
     {
    -    extern (Windows):
    +    extern (Windows):
     	...
     }
     
    @@ -445,96 +408,96 @@

    Starting with the code for the DLL, mydll.d: -

    /*
    +
    /*
      * MyDll demonstration of how to write D DLLs.
      */
     
    -import std.c.stdio;
    -import std.c.stdlib;
    -import std.string;
    -import std.c.windows.windows;
    -import std.gc;
    +import std.c.stdio;
    +import std.c.stdlib;
    +import std.string;
    +import std.c.windows.windows;
    +import std.gc;
     
     HINSTANCE   g_hInst;
     
    -extern (C)
    +extern (C)
     {
    -	void _minit();
    -	void _moduleCtor();
    -	void _moduleDtor();
    -	void _moduleUnitTests();
    +	void _minit();
    +	void _moduleCtor();
    +	void _moduleDtor();
    +	void _moduleUnitTests();
     }
     
    -extern (Windows)
    +extern (Windows)
         BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved)
     {
    -    switch (ulReason)
    +    switch (ulReason)
         {
    -        case DLL_PROCESS_ATTACH:
    -	    printf("DLL_PROCESS_ATTACH\n");
    -	    break;
    -
    -        case DLL_PROCESS_DETACH:
    -	    printf("DLL_PROCESS_DETACH\n");
    -	    std.c.stdio._fcloseallp = null; // so stdio doesn't get closed
    -	    break;
    -
    -        case DLL_THREAD_ATTACH:
    -	    printf("DLL_THREAD_ATTACH\n");
    -	    return false;
    -
    -        case DLL_THREAD_DETACH:
    -	    printf("DLL_THREAD_DETACH\n");
    -	    return false;
    +        case DLL_PROCESS_ATTACH:
    +	    printf("DLL_PROCESS_ATTACH\n");
    +	    break;
    +
    +        case DLL_PROCESS_DETACH:
    +	    printf("DLL_PROCESS_DETACH\n");
    +	    std.c.stdio._fcloseallp = null; // so stdio doesn't get closed
    +	    break;
    +
    +        case DLL_THREAD_ATTACH:
    +	    printf("DLL_THREAD_ATTACH\n");
    +	    return false;
    +
    +        case DLL_THREAD_DETACH:
    +	    printf("DLL_THREAD_DETACH\n");
    +	    return false;
         }
         g_hInst = hInstance;
    -    return true;
    +    return true;
     }
     
    -export void MyDLL_Initialize(void* gc)
    +export void MyDLL_Initialize(void* gc)
     {
    -    printf("MyDLL_Initialize()\n");
    +    printf("MyDLL_Initialize()\n");
         std.gc.setGCHandle(gc);
         _minit();
         _moduleCtor();
    -//  _moduleUnitTests();
    +//  _moduleUnitTests();
     }
     
    -export void MyDLL_Terminate()
    +export void MyDLL_Terminate()
     {
    -    printf("MyDLL_Terminate()\n");
    -    _moduleDtor();			// run module destructors
    +    printf("MyDLL_Terminate()\n");
    +    _moduleDtor();			// run module destructors
         std.gc.endGCHandle();
     }
     
    -static this()
    +static this()
     {
    -    printf("static this for mydll\n");
    +    printf("static this for mydll\n");
     }
     
    -static ~this()
    +static ~this()
     {
    -    printf("static ~this for mydll\n");
    +    printf("static ~this for mydll\n");
     }
     
    -/* --------------------------------------------------------- */
    +/* --------------------------------------------------------- */
     
    -class MyClass
    +class MyClass
     {
    -    char[] concat(char[] a, char[] b)
    +    char[] concat(char[] a, char[] b)
         {
    -	return a ~ " " ~ b;
    +	return a ~ " " ~ b;
         }
     
    -    void free(char[] s)
    +    void free(char[] s)
         {
    -	delete s;
    +	delete s;
         }
     }
     
    -export MyClass getMyClass()
    +export MyClass getMyClass()
     {
    -    return new MyClass();
    +    return new MyClass();
     }
     
    @@ -653,22 +616,22 @@ mydll.dll. There are two versions, one statically binds to the DLL, and the other dynamically loads it. -
    import std.stdio;
    -import std.gc;
    +
    import std.stdio;
    +import std.gc;
     
    -import mydll;
    +import mydll;
     
    -//version=DYNAMIC_LOAD;
    +//version=DYNAMIC_LOAD;
     
    -version (DYNAMIC_LOAD)
    +version (DYNAMIC_LOAD)
     {
    -    import std.c.windows.windows;
    +    import std.c.windows.windows;
     
    -    alias void function(void*) MyDLL_Initialize_fp;
    -    alias void function() MyDLL_Terminate_fp;
    -    alias MyClass function() getMyClass_fp;
    +    alias void function(void*) MyDLL_Initialize_fp;
    +    alias void function() MyDLL_Terminate_fp;
    +    alias MyClass function() getMyClass_fp;
     
    -    int main()
    +    int main()
         {	HMODULE h;
     	FARPROC fp;
     	MyDLL_Initialize_fp mydll_initialize;
    @@ -677,73 +640,73 @@
     	getMyClass_fp  getMyClass;
     	MyClass c;
     
    -	printf("Start Dynamic Link...\n");
    +	printf("Start Dynamic Link...\n");
     
    -	h = LoadLibraryA("mydll.dll");
    -	if (h == null)
    -	{   printf("error loading mydll.dll\n");
    -	    return 1;
    +	h = LoadLibraryA("mydll.dll");
    +	if (h == null)
    +	{   printf("error loading mydll.dll\n");
    +	    return 1;
     	}
     
    -	fp = GetProcAddress(h, "D5mydll16MyDLL_InitializeFPvZv");
    -	if (fp == null)
    -	{   printf("error loading symbol MyDLL_Initialize()\n");
    -	    return 1;
    +	fp = GetProcAddress(h, "D5mydll16MyDLL_InitializeFPvZv");
    +	if (fp == null)
    +	{   printf("error loading symbol MyDLL_Initialize()\n");
    +	    return 1;
     	}
     
    -	mydll_initialize = cast(MyDLL_Initialize_fp) fp;
    +	mydll_initialize = cast(MyDLL_Initialize_fp) fp;
     	(*mydll_initialize)(std.gc.getGCHandle());
     
    -	fp = GetProcAddress(h, "D5mydll10getMyClassFZC5mydll7MyClass");
    -	if (fp == null)
    -	{   printf("error loading symbol getMyClass()\n");
    -	    return 1;
    +	fp = GetProcAddress(h, "D5mydll10getMyClassFZC5mydll7MyClass");
    +	if (fp == null)
    +	{   printf("error loading symbol getMyClass()\n");
    +	    return 1;
     	}
     
    -	getMyClass = cast(getMyClass_fp) fp;
    +	getMyClass = cast(getMyClass_fp) fp;
     	c = (*getMyClass)();
     	foo(c);
     
    -	fp = GetProcAddress(h, "D5mydll15MyDLL_TerminateFZv");
    -	if (fp == null)
    -	{   printf("error loading symbol MyDLL_Terminate()\n");
    -	    return 1;
    +	fp = GetProcAddress(h, "D5mydll15MyDLL_TerminateFZv");
    +	if (fp == null)
    +	{   printf("error loading symbol MyDLL_Terminate()\n");
    +	    return 1;
     	}
     
    -	mydll_terminate = cast(MyDLL_Terminate_fp) fp;
    +	mydll_terminate = cast(MyDLL_Terminate_fp) fp;
     	(*mydll_terminate)();
     
    -	if (FreeLibrary(h) == FALSE)
    -	{   printf("error freeing mydll.dll\n");
    -	    return 1;
    +	if (FreeLibrary(h) == FALSE)
    +	{   printf("error freeing mydll.dll\n");
    +	    return 1;
     	}
     
    -	printf("End...\n");
    -	return 0;
    +	printf("End...\n");
    +	return 0;
         }
     }
    -else
    -{   // static link the DLL
    +else
    +{   // static link the DLL
     
    -    int main()
    +    int main()
         {
    -	printf("Start Static Link...\n");
    +	printf("Start Static Link...\n");
     	MyDLL_Initialize(std.gc.getGCHandle());
     	foo(getMyClass());
     	MyDLL_Terminate();
    -	printf("End...\n");
    -	return 0;
    +	printf("End...\n");
    +	return 0;
         }
     }
     
    -void foo(MyClass c)
    +void foo(MyClass c)
     {
    -    char[] s;
    +    char[] s;
     
    -    s = c.concat("Hello", "world!");
    +    s = c.concat("Hello", "world!");
         writefln(s);
         c.free(s);
    -    delete c;
    +    delete c;
     }
     
    diff -uNr dmd-0.156/dmd/html/d/dstyle.html dmd-0.157/dmd/html/d/dstyle.html --- dmd-0.156/dmd/html/d/dstyle.html 2006-04-27 21:15:54.000000000 +0200 +++ dmd-0.157/dmd/html/d/dstyle.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Thu Apr 27 21:15:52 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -222,13 +185,13 @@

    Comments

    • Use // comments to document a single line: -
      statement;	// comment
      -statement;	// comment
      +
      statement;	// comment
      +statement;	// comment
       
    • Use block comments to document a multiple line block of statements: -
      /*
      +
      /*
        * comment
        * comment
        */
      @@ -237,7 +200,7 @@
       
    • Use nesting comments to 'comment out' a piece of trial code: -
      /+++++
      +
      /+++++
           /*
            * comment
            * comment
      @@ -257,7 +220,7 @@
       	other than the first capitalized.
       	Names shall not begin with an underscore '_'.
       
      -
      int myFunc();
      +
      int myFunc();
       
      Module
      @@ -269,7 +232,7 @@
      C Modules
      Modules that are interfaces to C functions go into the "c" package, for example: -
      import std.c.stdio;
      +
      import std.c.stdio;
       
      Module names should be all lower case.

      @@ -277,15 +240,15 @@

      Class, Struct, Union, Enum names
      are capitalized. -
      class Foo;
      -class FooAndBar;
      +
      class Foo;
      +class FooAndBar;
       
      Function names
      Function names are not capitalized. -
      int done();
      -int doneProcessing();
      +
      int done();
      +int doneProcessing();
       
      Const names @@ -300,9 +263,9 @@ Things like: -
      alias void VOID;
      -alias int INT;
      -alias int* pint;
      +
      alias void VOID;
      +alias int INT;
      +alias int* pint;
       
      should be avoided. @@ -311,14 +274,14 @@ Since in D the declarations are left-associative, left justify them: -
      int[] x, y;	// makes it clear that x and y are the same type
      -int** p, q;	// makes it clear that p and q are the same type
      +
      int[] x, y;	// makes it clear that x and y are the same type
      +int** p, q;	// makes it clear that p and q are the same type
       
      to emphasize their relationship. Do not use the C style: -
      int []x, y;	// confusing since y is also an int[]
      -int **p, q;	// confusing since q is also an int**
      +
      int []x, y;	// confusing since y is also an int[]
      +int **p, q;	// confusing since q is also an int**
       

      Operator Overloading

      diff -uNr dmd-0.156/dmd/html/d/entity.html dmd-0.157/dmd/html/d/entity.html --- dmd-0.156/dmd/html/d/entity.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/entity.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
      Last update Wed Apr 26 22:34:30 2006 +
      Last update Mon May 8 15:25:42 2006
      @@ -57,97 +57,66 @@ · Lexical
      - · Modules
      - · Declarations
      - · Types
      - · Properties
      - · Attributes
      - · Pragmas
      - · Expressions
      - · Statements
      - · Arrays
      - · Structs & Unions
      - · Classes
      - · Interfaces
      - · Enums
      - · Functions
      - · Operator Overloading
      - · Templates
      - · Mixins
      - · Contracts
      - · Conditional Compilation
      - · Handling errors
      - · Garbage Collection
      - · Memory Management
      - · Floating Point
      - · Inline Assembler
      - · Documentation Comments
      - · Interfacing To C
      - · Portability Guide
      - · Embedding D in HTML
      - · Named Character Entities
      - · Application Binary Interface
      -
    Program - Compile - Compile Time - Run - Run Time -
    D wc - gdc -O2 -frelease -o wc wc.d - 0.28 - wc alice30.txt > /dev/null - 0.03 -
    C++ wccpp1 - g++ -O2 -o wccpp1 wccpp1.cc - 1.90 - wccpp1 alice30.txt > /dev/null - 0.07 -
    C++ wccpp2 - g++ -O2 -o wccpp2 wccpp2.cc - 1.88 - wccpp2 alice30.txt > /dev/null - 0.08 + + + + + + + + + + + + + + + + + + + + + + + +
    ProgramCompileCompile TimeRunRun Time
    D wcgdc -O2 -frelease -o wc wc.d0.28wc alice30.txt > /dev/null0.03
    C++ wccpp1g++ -O2 -o wccpp1 wccpp1.cc1.90wccpp1 alice30.txt > /dev/null0.07
    C++ wccpp2g++ -O2 -o wccpp2 wccpp2.cc1.88wccpp2 alice30.txt > /dev/null0.08

    wccpp2 by Allan Odgaard

    diff -uNr dmd-0.156/dmd/html/d/cpptod.html dmd-0.157/dmd/html/d/cpptod.html --- dmd-0.156/dmd/html/d/cpptod.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/cpptod.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,28 +57,20 @@ · D vs C/C++/C#/Java
    - · Rationale for Builtins
    - · Converting C to D
    - · Converting C++ to D
    - · The C Preprocessor vs D
    - · D strings vs C++ std::string
    - · D complex vs C++ std::complex
    - · D Contract Programming vs C++
    -
    @@ -133,9 +125,9 @@ Constructors are defined with the this keyword: -
    class Foo
    +
    class Foo
     {
    -	this(int x) { } 
    +	this(int x) { } 
     }
     
    @@ -161,12 +153,12 @@ The base class constructor is called with the super syntax: -
    class A { this() { ... } }
    -class B : A
    +
    class A { this() { ... } }
    +class B : A
     {
    -     this(int x)
    +     this(int x)
          {	...
    -	super();	// call base constructor 
    +	super();	// call base constructor 
     	...
          }
     }
    @@ -175,13 +167,13 @@
     	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(int x)
    +
    class A
    +{	int a;
    +	int b;
    +	this() { a = 7; b = foo(); } 
    +	this(int x)
     	{
    -	    this();
    +	    this();
     	    a = x;
     	}
     }
    @@ -190,13 +182,13 @@
     	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(int x)
    +
    class A
    +{	int a = 7;
    +	int b;
    +	this() { b = foo(); } 
    +	this(int x)
     	{
    -	    this();
    +	    this();
     	    a = x;
     	}
     }
    @@ -261,7 +253,7 @@
     
     
    A x, y;
     ...
    -if (x == y) 
    +if (x == y) 
         ...
     
    @@ -312,13 +304,13 @@ No need for idiomatic constructions like the above. Just write: -
    typedef void *Handle = cast(void *)-1; 
    -void bar(Handle);
    +
    typedef void *Handle = cast(void *)-1; 
    +void bar(Handle);
     
     Handle h;
     bar(h);
     h = func();
    -if (h != Handle.init)
    +if (h != Handle.init)
         ...
     
    @@ -368,27 +360,27 @@ in the same module, so implicitly granting friend access to other module members solves the problem neatly: -
    module X;
    +
    module X;
     
    -class A
    +class A
     {
    -    private:
    -	static int a;
    +    private:
    +	static int a;
     
    -    public:
    -	int foo(B j) { return j.b; }
    +    public:
    +	int foo(B j) { return j.b; }
     }
     
    -class B
    +class B
     {
    -    private:
    -	static int b;
    +    private:
    +	static int b;
     
    -    public:
    -	int bar(A j) { return j.a; } 
    +    public:
    +	int bar(A j) { return j.a; } 
     }
     
    -int abc(A p) { return p.a; }
    +int abc(A p) { return p.a; }
     
    The private attribute prevents other modules from @@ -424,9 +416,9 @@ D recognizes that the comparison operators are all fundamentally related to each other. So only one function is necessary: -
    struct A
    +
    struct A
     {
    -	int opCmp(int i); 
    +	int opCmp(int i); 
     }
     
    @@ -462,13 +454,13 @@ D uses modules instead of namespaces and #include files, and alias declarations take the place of using declarations: -
    /** Module Foo.d **/
    -module Foo;
    -int x;
    -
    -/** Another module **/ 
    -import Foo;
    -alias Foo.x x;
    +
    /** Module Foo.d **/
    +module Foo;
    +int x;
    +
    +/** Another module **/ 
    +import Foo;
    +alias Foo.x x;
     
    Alias is a much more flexible than the single purpose using @@ -507,22 +499,22 @@ The few RAII issues left are handled by auto classes. Auto classes get their destructors run when they go out of scope. -
    auto class File
    +
    auto class File
     {   Handle h;
     
    -    ~this()
    +    ~this()
         {
     	h.release();
         }
     }
     
    -void test()
    +void test()
     {
    -    if (...)
    -    {   auto File f = new File();
    +    if (...)
    +    {   auto File f = new File();
     	...
    -    } // f.~this() gets run at closing brace, even if 
    -      // scope was exited via a thrown exception
    +    } // f.~this() gets run at closing brace, even if 
    +      // scope was exited via a thrown exception
     }
     
    @@ -559,24 +551,24 @@ Properties can be get and set using the normal field syntax, yet the get and set will invoke methods instead. -
    class Abc
    +
    class Abc
     {
    -    // set 
    -    void property(int newproperty) { myprop = newproperty; }
    +    // set 
    +    void property(int newproperty) { myprop = newproperty; }
     
    -    // get
    -    int property() { return myprop; }
    +    // get
    +    int property() { return myprop; }
     
    -  private:
    -    int myprop;
    +  private:
    +    int myprop;
     }
     
    which is used as:
    Abc a;
    -a.property = 3;		// equivalent to a.property(3)
    -int x = a.property;	// equivalent to int x = a.property() 
    +a.property = 3;		// equivalent to a.property(3)
    +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. @@ -623,19 +615,19 @@ advantage of promotion of single template members to the enclosing name space: -
    template factorial(int n)
    +
    template factorial(int n)
     {
    -    enum { factorial = n * .factorial!(n-1) }
    +    enum { factorial = n * .factorial!(n-1) }
     }
     
    -template factorial(int n : 1)
    +template factorial(int n : 1)
     {
    -    enum { factorial = 1 }
    +    enum { factorial = 1 }
     }
     
    -void test()
    +void test()
     {
    -    printf("%d\n", factorial!(4));	// prints 24 
    +    printf("%d\n", factorial!(4));	// prints 24 
     }
     
    @@ -764,29 +756,29 @@ It compiles quickly, and gives a sensible compile time message if it fails. -
    template Integer(int nbits)
    +
    template Integer(int nbits)
     {
    -    static if (nbits <= 8)
    -	alias byte Integer;
    -    else static if (nbits <= 16)
    -	alias short Integer;
    -    else static if (nbits <= 32)
    -	alias int Integer;
    -    else static if (nbits <= 64)
    -	alias long Integer;
    -    else
    -	static assert(0);
    +    static if (nbits <= 8)
    +	alias byte Integer;
    +    else static if (nbits <= 16)
    +	alias short Integer;
    +    else static if (nbits <= 32)
    +	alias int Integer;
    +    else static if (nbits <= 64)
    +	alias long Integer;
    +    else
    +	static assert(0);
     }
     
    -int main()
    +int main()
     {
         Integer!(8) i ;
         Integer!(16) j ;
         Integer!(29) k ;
         Integer!(64) l ;
    -    printf("%d %d %d %d\n",
    +    printf("%d %d %d %d\n",
     	i.sizeof, j.sizeof, k.sizeof, l.sizeof); 
    -    return 0;
    +    return 0;
     }
     
    @@ -834,19 +826,19 @@ SFINAE can be done in D without resorting to template argument pattern matching: -
    template IsFunctionT(T)
    +
    template IsFunctionT(T)
     {
    -    static if ( is(T[]) )
    -	const int IsFunctionT = 1;
    -    else
    -	const int IsFunctionT = 0;
    +    static if ( is(T[]) )
    +	const int IsFunctionT = 1;
    +    else
    +	const int IsFunctionT = 0;
     }
     
    -void test()
    +void test()
     {
    -    typedef int fp(int);
    +    typedef int fp(int);
     
    -    assert(IsFunctionT!(fp) == 1);
    +    assert(IsFunctionT!(fp) == 1);
     }
     
    @@ -856,11 +848,11 @@ The is expression can test it directly: -
    void test()
    +
    void test()
     {
    -    typedef int fp(int);
    +    typedef int fp(int);
     
    -    assert( is(fp == function) );
    +    assert( is(fp == function) );
     }
     
    diff -uNr dmd-0.156/dmd/html/d/ctod.html dmd-0.157/dmd/html/d/ctod.html --- dmd-0.156/dmd/html/d/ctod.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/ctod.html 2006-05-08 15:25:42.000000000 +0200 @@ -26,7 +26,7 @@ " title="Read/write comments and feedback">Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -58,28 +58,20 @@ · D vs C/C++/C#/Java
    - · Rationale for Builtins
    - · Converting C to D
    - · Converting C++ to D
    - · The C Preprocessor vs D
    - · D strings vs C++ std::string
    - · D complex vs C++ std::complex
    - · D Contract Programming vs C++
    -
    @@ -90,6 +82,7 @@ Et tu, D? Then fall, C! -- William Nerdspeare + ouch! Every experienced C programmer accumulates a series of idioms and techniques @@ -157,20 +150,20 @@

    The C Way

    -
    	sizeof(int)
    -	sizeof(char *)
    -	sizeof(double)
    -	sizeof(struct Foo)
    +
    sizeof(int)
    +sizeof(char *)
    +sizeof(double)
    +sizeof(struct Foo)
     

    The D Way

    Use the size property:

    -
            int.sizeof
    -        (char *).sizeof
    -        double.sizeof
    -        Foo.sizeof
    +
    int.sizeof
    +(char *).sizeof
    +double.sizeof
    +Foo.sizeof
     

    @@ -179,22 +172,21 @@

    The C Way

    -
    	#include <limits.h>
    -	#include <math.h>
    +
    #include <limits.h>
    +#include <math.h>
     
    -	CHAR_MAX
    -	CHAR_MIN
    -	ULONG_MAX
    -	DBL_MIN
    +CHAR_MAX
    +CHAR_MIN
    +ULONG_MAX
    +DBL_MIN
     
    -

    The D Way

    -
            char.max
    -        char.min
    -        ulong.max
    -        double.min
    +
    char.max
    +char.min
    +ulong.max
    +double.min
     

    @@ -203,27 +195,25 @@

    C to D types

    -
            bool               =>        bit 
    -        char               =>        char 
    -        signed char        =>        byte 
    -        unsigned char      =>        ubyte 
    -        short              =>        short 
    -        unsigned short     =>        ushort 
    -        wchar_t            =>        wchar 
    -        int                =>        int 
    -        unsigned           =>        uint 
    -        long               =>        int 
    -        unsigned long      =>        uint 
    -        long long          =>        long 
    -        unsigned long long =>        ulong 
    -        float              =>        float 
    -        double             =>        double 
    -        long double        =>        real 
    -	_Imaginary long double =>    imaginary
    -	_Complex long double   =>    complex
    -
    +
    bool               =>        bit 
    +char               =>        char 
    +signed char        =>        byte 
    +unsigned char      =>        ubyte 
    +short              =>        short 
    +unsigned short     =>        ushort 
    +wchar_t            =>        wchar 
    +int                =>        int 
    +unsigned           =>        uint 
    +long               =>        int 
    +unsigned long      =>        uint 
    +long long          =>        long 
    +unsigned long long =>        ulong 
    +float              =>        float 
    +double             =>        double 
    +long double        =>        real 
    +_Imaginary long double =>    imaginary
    +_Complex long double   =>    complex
     
    -

    Although char is an unsigned 8 bit type, and wchar is an unsigned 16 bit type, they have their own separate types @@ -237,34 +227,33 @@

    The C Way

    -
           #include <fp.h> 
    +
    #include <fp.h> 
     
    -       NAN 
    -       INFINITY 
    +NAN 
    +INFINITY 
     
    -       #include <float.h> 
    +#include <float.h> 
     
    -       DBL_DIG 
    -       DBL_EPSILON 
    -       DBL_MANT_DIG 
    -       DBL_MAX_10_EXP 
    -       DBL_MAX_EXP 
    -       DBL_MIN_10_EXP 
    -       DBL_MIN_EXP 
    +DBL_DIG 
    +DBL_EPSILON 
    +DBL_MANT_DIG 
    +DBL_MAX_10_EXP 
    +DBL_MAX_EXP 
    +DBL_MIN_10_EXP 
    +DBL_MIN_EXP 
     
    -

    The D Way

    -
           double.nan 
    -       double.infinity 
    -       double.dig 
    -       double.epsilon 
    -       double.mant_dig 
    -       double.max_10_exp 
    -       double.max_exp 
    -       double.min_10_exp 
    -       double.min_exp 
    +
    double.nan 
    +double.infinity 
    +double.dig 
    +double.epsilon 
    +double.mant_dig 
    +double.max_10_exp 
    +double.max_exp 
    +double.min_10_exp 
    +double.min_exp 
     

    @@ -272,22 +261,20 @@

    The C Way

    -
    -       #include <math.h> 
    +
    #include <math.h> 
     
    -       float f = fmodf(x,y); 
    -       double d = fmod(x,y); 
    -       long double r = fmodl(x,y); 
    +float f = fmodf(x,y); 
    +double d = fmod(x,y); 
    +long double r = fmodl(x,y); 
     
    -

    The D Way

    D supports the remainder ('%') operator on floating point operands: -
           float f = x % y; 
    -       double d = x % y; 
    -       real r = x % y; 
    +
    float f = x % y; 
    +double d = x % y; 
    +real r = x % y; 
     

    @@ -300,22 +287,20 @@ is NAN, and few C compilers check for it (the Digital Mars C compiler is an exception, DM's compilers do check for NAN operands). -
    -       #include <math.h> 
    +
    #include <math.h> 
     
    -       if (isnan(x) || isnan(y)) 
    -	   result = FALSE; 
    -       else 
    -	   result = (x < y); 
    +if (isnan(x) || isnan(y)) 
    +   result = FALSE; 
    +else 
    +   result = (x < y); 
     
    -

    The D Way

    -

    + D offers a full complement of comparisons and operators that work with NAN arguments. -

           result = (x < y);        // false if x or y is nan 
    +
    result = (x < y);        // false if x or y is nan 
     

    @@ -337,7 +322,7 @@ D simply builds assert into the language: -
    assert(e == 0); 
    +
    assert(e == 0); 
     

    @@ -346,18 +331,16 @@

    The C Way

    -
    -       #define ARRAY_LENGTH        17 
    -       int array[ARRAY_LENGTH]; 
    -       for (i = 0; i < ARRAY_LENGTH; i++) 
    -	   array[i] = value; 
    +
    #define ARRAY_LENGTH        17 
    +int array[ARRAY_LENGTH]; 
    +for (i = 0; i < ARRAY_LENGTH; i++) 
    +   array[i] = value; 
     
    -

    The D Way

    -
           int array[17]; 
    -       array[] = value; 
    +
    int array[17]; 
    +array[] = value; 
     

    @@ -369,37 +352,33 @@ The array length is defined separately, or a clumsy sizeof() expression is used to get the length. -
    -       #define ARRAY_LENGTH        17 
    -       int array[ARRAY_LENGTH]; 
    -       for (i = 0; i < ARRAY_LENGTH; i++) 
    -	   func(array[i]); 
    +
    #define ARRAY_LENGTH        17 
    +int array[ARRAY_LENGTH]; 
    +for (i = 0; i < ARRAY_LENGTH; i++) 
    +   func(array[i]); 
     
    - or: -
    -       int array[17]; 
    -       for (i = 0; i < sizeof(array) / sizeof(array[0]); i++) 
    -	   func(array[i]); 
    +
    int array[17]; 
    +for (i = 0; i < sizeof(array) / sizeof(array[0]); i++) 
    +   func(array[i]); 
     
    -

    The D Way

    The length of an array is accessible the property "length". -
           int array[17]; 
    -       for (i = 0; i < array.length; i++) 
    -	   func(array[i]); 
    +
    int array[17]; 
    +for (i = 0; i < array.length; i++) 
    +   func(array[i]); 
     
    or even better: -
           int array[17]; 
    -       foreach (int value; array)
    -	   func(value); 
    +
    int array[17]; 
    +foreach (int value; array)
    +   func(value); 
     
    @@ -413,31 +392,29 @@ variable for the length, and then explicitly manage the size of the array: -
    -       #include <stdlib.h> 
    +
    #include <stdlib.h> 
     
    -       int array_length; 
    -       int *array; 
    -       int *newarray; 
    -
    -       newarray = (int *)
    -	   realloc(array, (array_length + 1) * sizeof(int)); 
    -       if (!newarray) 
    -	   error("out of memory"); 
    -       array = newarray; 
    -       array[array_length++] = x; 
    +int array_length; 
    +int *array; 
    +int *newarray; 
    +
    +newarray = (int *)
    +   realloc(array, (array_length + 1) * sizeof(int)); 
    +if (!newarray) 
    +   error("out of memory"); 
    +array = newarray; 
    +array[array_length++] = x; 
     
    -

    The D Way

    D supports dynamic arrays, which can be easily resized. D supports all the requisite memory management. -
           int[] array; 
    +
    int[] array; 
     
    -       array.length = array.length + 1;
    -       array[array.length - 1] = x; 
    +array.length = array.length + 1;
    +array[array.length - 1] = x; 
     

    @@ -450,50 +427,48 @@ when can storage be free'd, dealing with null pointers, finding the length of the strings, and memory allocation: -
     
    -       #include <string.h> 
    +
    #include <string.h> 
     
    -       char *s1; 
    -       char *s2; 
    -       char *s; 
    -
    -       // Concatenate s1 and s2, and put result in s 
    -       free(s); 
    -       s = (char *)malloc((s1 ? strlen(s1) : 0) + 
    -			  (s2 ? strlen(s2) : 0) + 1); 
    -       if (!s) 
    -	   error("out of memory"); 
    -       if (s1) 
    -	   strcpy(s, s1); 
    -       else 
    -	   *s = 0; 
    -       if (s2) 
    -	   strcpy(s + strlen(s), s2); 
    -
    -       // Append "hello" to s 
    -       char hello[] = "hello"; 
    -       char *news; 
    -       size_t lens = s ? strlen(s) : 0; 
    -       news = (char *)
    -	   realloc(s, (lens + sizeof(hello) + 1) * sizeof(char)); 
    -       if (!news) 
    -	   error("out of memory"); 
    -       s = news; 
    -       memcpy(s + lens, hello, sizeof(hello)); 
    +char *s1; 
    +char *s2; 
    +char *s; 
    +
    +// Concatenate s1 and s2, and put result in s 
    +free(s); 
    +s = (char *)malloc((s1 ? strlen(s1) : 0) + 
    +		  (s2 ? strlen(s2) : 0) + 1); 
    +if (!s) 
    +   error("out of memory"); 
    +if (s1) 
    +   strcpy(s, s1); 
    +else 
    +   *s = 0; 
    +if (s2) 
    +   strcpy(s + strlen(s), s2); 
    +
    +// Append "hello" to s 
    +char hello[] = "hello"; 
    +char *news; 
    +size_t lens = s ? strlen(s) : 0; 
    +news = (char *)
    +   realloc(s, (lens + sizeof(hello) + 1) * sizeof(char)); 
    +if (!news) 
    +   error("out of memory"); 
    +s = news; 
    +memcpy(s + lens, hello, sizeof(hello)); 
     
    -

    The D Way

    D overloads the operators ~ and ~= for char and wchar arrays to mean concatenate and append, respectively: -
           char[] s1; 
    -       char[] s2; 
    -       char[] s; 
    +
    char[] s1; 
    +char[] s2; 
    +char[] s; 
     
    -       s = s1 ~ s2; 
    -       s ~= "hello"; 
    +s = s1 ~ s2; 
    +s ~= "hello"; 
     

    @@ -504,20 +479,18 @@ printf() is the general purpose formatted print routine: -
    -       #include <stdio.h> 
    +
    #include <stdio.h> 
     
    -       printf("Calling all cars %d times!\n", ntimes); 
    +printf("Calling all cars %d times!\n", ntimes); 
     
    -

    The D Way

    What can we say? printf() rules: -
           import stdio; 
    +
    import stdio; 
     
    -       printf("Calling all cars %d times!\n", ntimes); 
    +printf("Calling all cars %d times!\n", ntimes); 
     

    @@ -530,21 +503,19 @@ not yet encountered in the source file, it is necessary to insert a function declaration lexically preceding the call. -
    -       void forwardfunc(); 
    +
    void forwardfunc(); 
     
    -       void myfunc() 
    -       {   
    -	   forwardfunc(); 
    -       } 
    +void myfunc() 
    +{   
    +   forwardfunc(); 
    +} 
     
    -       void forwardfunc() 
    -       {   
    -	   ... 
    -       } 
    +void forwardfunc() 
    +{   
    +   ... 
    +} 
     
    -

    The D Way

    The program is looked at as a whole, and so not only is it not @@ -553,15 +524,15 @@ referenced function declarations twice. Functions can be defined in any order. -
            void myfunc() 
    -        {   
    -	   forwardfunc(); 
    -        } 
    -
    -        void forwardfunc() 
    -        {   
    -	   ... 
    -        } 
    +
    void myfunc() 
    +{   
    +   forwardfunc(); 
    +} 
    +
    +void forwardfunc() 
    +{   
    +   ... 
    +} 
     

    @@ -570,21 +541,19 @@

    The C Way

    -
    -       void function(void); 
    +
    void function(void); 
     
    -

    The D Way

    D is a strongly typed language, so there is no need to explicitly say a function takes no arguments, just don't declare it has having arguments. -
           void function() 
    -       {   
    -	   ... 
    -       } 
    +
    void function()
    +{
    +   ...
    +}
     

    @@ -596,42 +565,40 @@ Break's and continue's only apply to the innermost nested loop or switch, so a multilevel break must use a goto: -
    -       for (i = 0; i < 10; i++) 
    +
        for (i = 0; i < 10; i++) 
    +    {   
    +       for (j = 0; j < 10; j++) 
            {   
    -	   for (j = 0; j < 10; j++) 
    -	   {   
    -	       if (j == 3) 
    -		   goto Louter; 
    -	       if (j == 4) 
    -		   goto L2; 
    -	   } 
    -	 L2: 
    -	   ; 
    +	   if (j == 3) 
    +	       goto Louter; 
    +	   if (j == 4) 
    +	       goto L2; 
            } 
    -   Louter: 
    +     L2: 
            ; 
    +    } 
    +Louter: 
    +    ; 
     
    -

    The D Way

    Break and continue statements can be followed by a label. The label is the label for an enclosing loop or switch, and the break applies to that loop. -
         Louter: 
    -       for (i = 0; i < 10; i++) 
    +
    Louter: 
    +   for (i = 0; i < 10; i++) 
    +   {   
    +       for (j = 0; j < 10; j++) 
            {   
    -	   for (j = 0; j < 10; j++) 
    -	   {   
    -	       if (j == 3) 
    -		   break Louter; 
    -	       if (j == 4) 
    -		   continue Louter; 
    -	   } 
    +	   if (j == 3) 
    +	       break Louter; 
    +	   if (j == 4) 
    +	       continue Louter; 
            } 
    -       // break Louter goes here 
    +   } 
    +   // break Louter goes here 
     

    @@ -658,17 +625,15 @@ It's annoying to have to put the struct keyword every time a type is specified, so a common idiom is to use: -
    -       typedef struct ABC { ... } ABC; 
    +
    typedef struct ABC { ... } ABC; 
     
    -

    The D Way

    Struct tag names are not in a separate name space, they are in the same name space as ordinary names. Hence: -
           struct ABC { ... }; 
    +
    struct ABC { ... }; 
     

    @@ -681,30 +646,28 @@ values and take action based on which one it is. A typical use for this might be command line argument processing. -
    -       #include <string.h> 
    -       void dostring(char *s) 
    -       {   
    -	   enum Strings { Hello, Goodbye, Maybe, Max }; 
    -	   static char *table[] = { "hello", "goodbye", "maybe" }; 
    -	   int i; 
    -
    -	   for (i = 0; i < Max; i++) 
    -	   {   
    -	       if (strcmp(s, table[i]) == 0) 
    -		   break; 
    -	   } 
    -	   switch (i) 
    -	   {   
    -	       case Hello:   ... 
    -	       case Goodbye: ... 
    -	       case Maybe:   ... 
    -	       default:      ... 
    -	   } 
    -       } 
    +
    #include <string.h> 
    +void dostring(char *s) 
    +{   
    +   enum Strings { Hello, Goodbye, Maybe, Max }; 
    +   static char *table[] = { "hello", "goodbye", "maybe" }; 
    +   int i; 
    +
    +   for (i = 0; i < Max; i++) 
    +   {   
    +       if (strcmp(s, table[i]) == 0) 
    +	   break; 
    +   } 
    +   switch (i) 
    +   {   
    +       case Hello:   ... 
    +       case Goodbye: ... 
    +       case Maybe:   ... 
    +       default:      ... 
    +   } 
    +} 
     
    - The problem with this is trying to maintain 3 parallel data structures, the enum, the table, and the switch cases. If there are a lot of values, the connection between the 3 may not be so @@ -723,16 +686,16 @@ strings as well as numbers. Then, the way to code the string lookup becomes straightforward: -
           void dostring(char[] s) 
    -       {   
    -	   switch (s) 
    -	   {   
    -	       case "hello":   ... 
    -	       case "goodbye": ... 
    -	       case "maybe":   ... 
    -	       default:        ... 
    -	   } 
    -       } 
    +
    void dostring(char[] s) 
    +{   
    +   switch (s) 
    +   {   
    +       case "hello":   ... 
    +       case "goodbye": ... 
    +       case "maybe":   ... 
    +       default:        ... 
    +   } 
    +} 
     
    Adding new cases becomes easy. The compiler can be relied on @@ -749,16 +712,14 @@ program, and woe results if any modules or libraries didn't get recompiled. To address this, #pragma's are used: -
    -           #pragma pack(1) 
    -           struct ABC 
    -           { 
    -               ... 
    -           }; 
    -           #pragma pack() 
    +
    #pragma pack(1) 
    +struct ABC 
    +{   
    +   ... 
    +}; 
    +#pragma pack() 
     
    - But #pragmas are nonportable both in theory and in practice from compiler to compiler. @@ -767,19 +728,19 @@ Clearly, since much of the point to setting alignment is for portability of data, a portable means of expressing it is necessary. -
               struct ABC 
    -           { 
    -               int z;               // z is aligned to the default 
    +
    struct ABC 
    +{   
    +   int z;               // z is aligned to the default 
     
    -             align (1) int x;       // x is byte aligned 
    -             align (4) 
    -             { 
    -               ...                  // declarations in {} are dword aligned 
    -             } 
    -             align (2):             // switch to word alignment from here on 
    + align (1) int x;       // x is byte aligned 
    + align (4) 
    + {   
    +   ...                  // declarations in {} are dword aligned 
    + } 
    + align (2):             // switch to word alignment from here on 
     
    -               int y;               // y is word aligned 
    -           } 
    +   int y;               // y is word aligned 
    +} 
     

    @@ -793,29 +754,27 @@ C doesn't allow anonymous structs or unions, which means that dummy tag names and dummy members are necessary: -
    -       struct Foo 
    -       {   int i; 
    -	   union Bar 
    -	   {   
    -	       struct Abc { int x; long y; } _abc; 
    -	       char *p; 
    -	   } _bar; 
    -       }; 
    -
    -       #define x _bar._abc.x 
    -       #define y _bar._abc.y 
    -       #define p _bar.p 
    -
    -       struct Foo f; 
    -
    -       f.i; 
    -       f.x; 
    -       f.y; 
    -       f.p; 
    +
    struct Foo 
    +{   int i; 
    +   union Bar 
    +   {   
    +       struct Abc { int x; long y; } _abc; 
    +       char *p; 
    +   } _bar; 
    +}; 
    +
    +#define x _bar._abc.x 
    +#define y _bar._abc.y 
    +#define p _bar.p 
    +
    +struct Foo f; 
    +
    +f.i; 
    +f.x; 
    +f.y; 
    +f.p; 
     
    - Not only is it clumsy, but using macros means a symbolic debugger won't understand what is being done, and the macros have global scope instead of struct scope. @@ -824,21 +783,21 @@ Anonymous structs and unions are used to control the layout in a more natural manner: -
           struct Foo 
    -       {   int i; 
    -	   union 
    -	   {   
    -	       struct { int x; long y; } 
    -	       char* p; 
    -	   } 
    -       } 
    +
    struct Foo 
    +{   int i; 
    +   union 
    +   {   
    +       struct { int x; long y; } 
    +       char* p; 
    +   } 
    +} 
     
    -       Foo f; 
    +Foo f; 
     
    -       f.i; 
    -       f.x; 
    -       f.y; 
    -       f.p; 
    +f.i; 
    +f.x; 
    +f.y; 
    +f.p; 
     

    @@ -849,25 +808,21 @@ Is to do it in one statement ending with a semicolon: -
    -           struct Foo { int x; int y; } foo; 
    +
    struct Foo { int x; int y; } foo; 
     
    - Or to separate the two: -
    -           struct Foo { int x; int y; };   // note terminating ; 
    -           struct Foo foo; 
    +
    struct Foo { int x; int y; };   // note terminating ; 
    +struct Foo foo; 
     
    -

    The D Way

    Struct definitions and declarations can't be done in the same statement: -
           struct Foo { int x; int y; }    // note there is no terminating ; 
    -       Foo foo; 
    +
    struct Foo { int x; int y; }    // note there is no terminating ; 
    +Foo foo; 
     
    which means that the terminating ; can be dispensed with, eliminating the @@ -882,21 +837,19 @@ Naturally, another macro is used: -
    -       #include <stddef> 
    -       struct Foo { int x; int y; }; 
    +
    #include <stddef> 
    +struct Foo { int x; int y; }; 
     
    -       off = offsetof(Foo, y); 
    +off = offsetof(Foo, y); 
     
    -

    The D Way

    An offset is just another property: -
           struct Foo { int x; int y; } 
    +
    struct Foo { int x; int y; } 
     
    -       off = Foo.y.offset; 
    +off = Foo.y.offset; 
     

    @@ -907,12 +860,10 @@ Unions are initialized using the "first member" rule: -
    -       union U { int a; long b; }; 
    -       union U x = { 5 };                // initialize member 'a' to 5 
    +
    union U { int a; long b; }; 
    +union U x = { 5 };                // initialize member 'a' to 5 
     
    - Adding union members or rearranging them can have disastrous consequences for any initializers. @@ -920,8 +871,8 @@ In D, which member is being initialized is mentioned explicitly: -
           union U { int a; long b; } 
    -       U x = { a:5 } 
    +
    union U { int a; long b; } 
    +U x = { a:5 } 
     
    avoiding the confusion and maintenance problems. @@ -934,12 +885,10 @@ Members are initialized by their position within the {}'s: -
    -       struct S { int a; int b; }; 
    -       struct S x = { 5, 3 }; 
    +
    struct S { int a; int b; }; 
    +struct S x = { 5, 3 }; 
     
    - This isn't much of a problem with small structs, but when there are numerous members, it becomes tedious to get the initializers carefully lined up with the field declarations. Then, if members are @@ -950,8 +899,8 @@ Member initialization can be done explicitly: -
           struct S { int a; int b; } 
    -       S x = { b:3, a:5 } 
    +
    struct S { int a; int b; } 
    +S x = { b:3, a:5 } 
     
    The meaning is clear, and there no longer is a positional dependence. @@ -963,37 +912,33 @@

    The C Way

    C initializes array by positional dependence: -
    -           int a[3] = { 3,2,2 }; 
    +
    int a[3] = { 3,2,2 }; 
     
    - Nested arrays may or may not have the { }: -
    -           int b[3][2] = { 2,3, {6,5}, 3,4 }; 
    +
    int b[3][2] = { 2,3, {6,5}, 3,4 }; 
     
    -

    The D Way

    D does it by positional dependence too, but an index can be used as well: The following all produce the same result: -
        int[3] a = [ 3, 2, 0 ]; 
    -    int[3] a = [ 3, 2 ];            // unsupplied initializers are 0, just like in C 
    -    int[3] a = [ 2:0, 0:3, 1:2 ]; 
    -    int[3] a = [ 2:0, 0:3, 2 ];     // if not supplied, the index is the
    -                                    // previous one plus one. 
    +
    int[3] a = [ 3, 2, 0 ]; 
    +int[3] a = [ 3, 2 ];            // unsupplied initializers are 0, just like in C 
    +int[3] a = [ 2:0, 0:3, 1:2 ]; 
    +int[3] a = [ 2:0, 0:3, 2 ];     // if not supplied, the index is the
    +				// previous one plus one. 
     
    This can be handy if the array will be indexed by an enum, and the order of enums may be changed or added to: -
        enum color { black, red, green }
    -    int[3] c = [ black:3, green:2, red:5 ]; 
    +
    enum color { black, red, green }
    +int[3] c = [ black:3, green:2, red:5 ]; 
     
    Nested array initializations must be explicit: -
        int[2][3] b = [ [2,3], [6,5], [3,4] ]; 
    +
    int[2][3] b = [ [2,3], [6,5], [3,4] ]; 
     
    -    int[2][3] b = [[2,6,3],[3,5,4]];            // error 
    +int[2][3] b = [[2,6,3],[3,5,4]];            // error 
     

    @@ -1003,32 +948,26 @@

    The C Way

    C has problems with the DOS file system because a \ is an escape in a string. To specifiy file c:\root\file.c: -
    -    char file[] = "c:\\root\\file.c"; 
    +
    char file[] = "c:\\root\\file.c"; 
     
    - This gets even more unpleasant with regular expressions. Consider the escape sequence to match a quoted string: -
    -    /"[^\\]*(\\.[^\\]*)*"/
    +
    /"[^\\]*(\\.[^\\]*)*"/
     
    -

    In C, this horror is expressed as: -

    -    char quoteString[] = "\"[^\\\\]*(\\\\.[^\\\\]*)*\"";
    +
    char quoteString[] = "\"[^\\\\]*(\\\\.[^\\\\]*)*\"";
     
    -

    The D Way

    Within strings, it is WYSIWYG (what you see is what you get). Escapes are in separate strings. So: -
        char[] file = `c:\root\file.c`; 
    -    char[] quoteString = \"  r"[^\\]*(\\.[^\\]*)*"  \";
    +
    char[] file = `c:\root\file.c`; 
    +char[] quoteString = \"  r"[^\\]*(\\.[^\\]*)*"  \";
     
    The famous hello world string becomes: -
        char[] hello = "hello world" \n; 
    +
    char[] hello = "hello world" \n; 
     

    @@ -1040,24 +979,20 @@

    The C Way

    C uses the wchar_t and the L prefix on strings: -
    -    #include <wchar.h> 
    -    char foo_ascii[] = "hello"; 
    -    wchar_t foo_wchar[] = L"hello"; 
    +
    #include <wchar.h> 
    +char foo_ascii[] = "hello"; 
    +wchar_t foo_wchar[] = L"hello"; 
     
    - Things get worse if code is written to be both ascii and wchar compatible. A macro is used to switch strings from ascii to wchar: -
    -    #include <tchar.h> 
    -    tchar string[] = TEXT("hello"); 
    +
    #include <tchar.h> 
    +tchar string[] = TEXT("hello"); 
     
    -

    The D Way

    The type of a string is determined by semantic analysis, so there is no need to wrap strings in a macro call: -
        char[] foo_ascii = "hello";            // string is taken to be ascii 
    -    wchar[] foo_wchar = "hello";       // string is taken to be wchar 
    +
    char[] foo_ascii = "hello";        // string is taken to be ascii 
    +wchar[] foo_wchar = "hello";       // string is taken to be wchar 
     

    @@ -1067,22 +1002,20 @@

    The C Way

    Consider: -
    -       enum COLORS { red, blue, green, max }; 
    -       char *cstring[max] = {"red", "blue", "green" }; 
    +
    enum COLORS { red, blue, green, max }; 
    +char *cstring[max] = {"red", "blue", "green" }; 
     
    - This is fairly easy to get right because the number of entries is small. But suppose it gets to be fairly large. Then it can get difficult to maintain correctly when new entries are added.

    The D Way

    -
       enum COLORS { red, blue, green }
    +
    enum COLORS { red, blue, green }
     
    -    char[][COLORS.max + 1] cstring = 
    -    [
    -	COLORS.red   : "red",
    -	COLORS.blue  : "blue", 
    -	COLORS.green : "green",
    -    ]; 
    +char[][COLORS.max + 1] cstring = 
    +[
    +    COLORS.red   : "red",
    +    COLORS.blue  : "blue", 
    +    COLORS.green : "green",
    +]; 
     
    Not perfect, but better. @@ -1097,62 +1030,54 @@ a new type. The compiler doesn't distinguish between a typedef and its underlying type. -
    -	typedef void *Handle;
    -	void foo(void *);
    -	void bar(Handle);
    -
    -	Handle h;
    -	foo(h);			// coding bug not caught
    -	bar(h);			// ok
    -	
    - +
    typedef void *Handle;
    +void foo(void *);
    +void bar(Handle);
    +
    +Handle h;
    +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. -
    -	struct Handle__ { void *value; }
    -	typedef struct Handle__ *Handle;
    -	void foo(void *);
    -	void bar(Handle);
    -
    -	Handle h;
    -	foo(h);			// syntax error
    -	bar(h);			// ok
    -	
    - +
    struct Handle__ { void *value; }
    +typedef struct Handle__ *Handle;
    +void foo(void *);
    +void bar(Handle);
    +
    +Handle h;
    +foo(h);			// syntax error
    +bar(h);			// ok
    +
    Having a default value for the type involves defining a macro, a naming convention, and then pedantically following that convention: -
    -	#define HANDLE_INIT ((Handle)-1)
    -
    -	Handle h = HANDLE_INIT;
    -	h = func();
    -	if (h != HANDLE_INIT)
    -	    ...
    -	
    +
    #define HANDLE_INIT ((Handle)-1)
     
    +Handle h = HANDLE_INIT;
    +h = func();
    +if (h != HANDLE_INIT)
    +    ...
    +
    For the struct solution, things get even more complex: -
    -	struct Handle__ HANDLE_INIT;
    +
    struct Handle__ HANDLE_INIT;
     
    -	void init_handle()	// call this function upon startup
    -	{
    -	    HANDLE_INIT.value = (void *)-1;
    -	}
    +void init_handle()	// call this function upon startup
    +{
    +    HANDLE_INIT.value = (void *)-1;
    +}
     
    -	Handle h = HANDLE_INIT;
    -	h = func();
    -	if (memcmp(&h,&HANDLE_INIT,sizeof(Handle)) != 0)
    -	    ...
    +Handle h = HANDLE_INIT;
    +h = func();
    +if (memcmp(&h,&HANDLE_INIT,sizeof(Handle)) != 0)
    +    ...
     
    - There are 4 names to remember: Handle, HANDLE_INIT, struct Handle__, value. @@ -1160,23 +1085,23 @@ No need for idiomatic constructions like the above. Just write: -
    	typedef void* Handle;
    -	void foo(void*);
    -	void bar(Handle);
    -
    -	Handle h;
    -	foo(h);
    -	bar(h);
    +
    typedef void* Handle;
    +void foo(void*);
    +void bar(Handle);
    +
    +Handle h;
    +foo(h);
    +bar(h);
     
    To handle a default value, add an initializer to the typedef, and refer to it with the .init property: -
    	typedef void* Handle = cast(void*)(-1);
    -	Handle h;
    -	h = func();
    -	if (h != Handle.init)
    -	    ...
    +
    typedef void* Handle = cast(void*)(-1);
    +Handle h;
    +h = func();
    +if (h != Handle.init)
    +    ...
     
    There's only one name to remember: Handle. @@ -1189,25 +1114,21 @@ While C defines struct assignment in a simple, convenient manner: -
    -	struct A x, y;
    -	...
    -	x = y;
    -	
    - +
    struct A x, y;
    +...
    +x = y;
    +
    it does not for struct comparisons. Hence, to compare two struct instances for equality: -
    -	#include <string.h>
    -
    -	struct A x, y;
    -	...
    -	if (memcmp(&x, &y, sizeof(struct A)) == 0)
    -	    ...
    -	
    +
    #include <string.h>
     
    +struct A x, y;
    +...
    +if (memcmp(&x, &y, sizeof(struct A)) == 0)
    +    ...
    +
    Note the obtuseness of this, coupled with the lack of any kind of help from the language with type checking. @@ -1223,10 +1144,10 @@ D does it the obvious, straightforward way: -
    	A x, y;
    -	...
    -	if (x == y)
    -	    ...
    +
    A x, y;
    +...
    +if (x == y)
    +    ...
     
    @@ -1236,13 +1157,11 @@

    The C Way

    The library function strcmp() is used: -
    -	char string[] = "hello";
    -
    -	if (strcmp(string, "betty") == 0)	// do strings match?
    -	    ...
    -	
    +
    char string[] = "hello";
     
    +if (strcmp(string, "betty") == 0)	// do strings match?
    +    ...
    +
    C uses 0 terminated strings, so the C way has an inherent inefficiency in constantly scanning for the terminating 0. @@ -1251,10 +1170,10 @@ Why not use the == operator? -
    	char[] string = "hello";
    +
    char[] string = "hello";
     
    -	if (string == "betty")
    -	    ...
    +if (string == "betty")
    +    ...
     
    D strings have the length stored separately from the string. @@ -1265,10 +1184,10 @@ D supports comparison operators on strings, too: -
    	char[] string = "hello";
    +
    char[] string = "hello";
     
    -	if (string < "betty")
    -	    ...
    +if (string < "betty")
    +    ...
     
    which is useful for sorting/searching. @@ -1281,21 +1200,19 @@ Although many C programmers tend to reimplmement bubble sorts over and over, the right way to sort in C is to use qsort(): -
    -	int compare(const void *p1, const void *p2)
    -	{
    -	    type *t1 = (type *)p1;
    -	    type *t1 = (type *)p2;
    -
    -	    return *t1 - *t2;
    -	}
    +
    int compare(const void *p1, const void *p2)
    +{
    +    type *t1 = (type *)p1;
    +    type *t1 = (type *)p2;
     
    -	type array[10];
    -	...
    -	qsort(array, sizeof(array)/sizeof(array[0]),
    -		sizeof(array[0]), compare);
    -	
    + return *t1 - *t2; +} +type array[10]; +... +qsort(array, sizeof(array)/sizeof(array[0]), + sizeof(array[0]), compare); +
    A compare() must be written for each type, and much careful typo-prone code needs to be written to make it work. @@ -1305,9 +1222,9 @@ Sorting couldn't be easier: -
    	type[] array;
    -	...
    -	array.sort;		// sort array in-place
    +
    type[] array;
    +...
    +array.sort;      // sort array in-place
     

    @@ -1317,20 +1234,18 @@ To access volatile memory, such as shared memory or memory mapped I/O, a pointer to volatile is created: -
    -	volatile int *p = address;
    -
    -	i = *p;
    -	
    +
    volatile int *p = address;
     
    +i = *p;
    +

    The D Way

    D has volatile as a statement type, not as a type modifier: -
    	int* p = address;
    +
    int* p = address;
     
    -	volatile { i = *p; }
    +volatile { i = *p; }
     

    @@ -1341,12 +1256,10 @@ String literals in C cannot span multiple lines, so to have a block of text it is necessary to use \ line splicing: -
    -	"This text spans\n\
    -	multiple\n\
    -	lines\n"
    -	
    - +
    "This text spans\n\
    +multiple\n\
    +lines\n"
    +
    If there is a lot of text, this can wind up being tedious. @@ -1354,10 +1267,10 @@ String literals can span multiple lines, as in: -
    	"This text spans
    -	multiple
    -	lines
    -	"
    +
    "This text spans
    +multiple
    +lines
    +"
     
    So blocks of text can just be cut and pasted into the D @@ -1382,50 +1295,48 @@ some context outside of the trees, so a custom struct Paramblock is created and a pointer to it is used to maximize efficiency. -
    -    struct Symbol
    -    {	char *id;
    -	struct Symbol *left;
    -	struct Symbol *right;
    -    };
    -
    -    struct Paramblock
    -    {   char *id;
    -	struct Symbol *sm;
    -    };
    +
    struct Symbol
    +{   char *id;
    +struct Symbol *left;
    +struct Symbol *right;
    +};
    +
    +struct Paramblock
    +{   char *id;
    +struct Symbol *sm;
    +};
     
    -    static void membersearchx(struct Paramblock *p, struct Symbol *s)
    +static void membersearchx(struct Paramblock *p, struct Symbol *s)
    +{
    +while (s)
    +{
    +    if (strcmp(p->id,s->id) == 0)
         {
    -	while (s)
    -	{
    -	    if (strcmp(p->id,s->id) == 0)
    -	    {
    -		if (p->sm)
    -		    error("ambiguous member %s\n",p->id);
    -		p->sm = s;
    -	    }
    -
    -	    if (s->left)
    -		membersearchx(p,s->left);
    -	    s = s->right;
    -	}
    +	if (p->sm)
    +	    error("ambiguous member %s\n",p->id);
    +	p->sm = s;
         }
     
    -    struct Symbol *symbol_membersearch(Symbol *table[], int tablemax, char *id)
    -    {
    -	struct Paramblock pb;
    -	int i;
    +    if (s->left)
    +	membersearchx(p,s->left);
    +    s = s->right;
    +}
    +}
     
    -	pb.id = id;
    -	pb.sm = NULL;
    -	for (i = 0; i < tablemax; i++)
    -	{
    -	    membersearchx(pb, table[i]);
    -	}
    -	return pb.sm;
    -    }
    -    
    +struct Symbol *symbol_membersearch(Symbol *table[], int tablemax, char *id) +{ +struct Paramblock pb; +int i; +pb.id = id; +pb.sm = NULL; +for (i = 0; i < tablemax; i++) +{ + membersearchx(pb, table[i]); +} +return pb.sm; +} +

    The D Way

    @@ -1439,38 +1350,38 @@ The performance of the two versions is indistinguishable. -
        class Symbol
    -    {	char[] id;
    -	Symbol left;
    -	Symbol right;
    -    }
    +
    class Symbol
    +{   char[] id;
    +    Symbol left;
    +    Symbol right;
    +}
     
    -    Symbol symbol_membersearch(Symbol[] table, char[] id)
    -    {   Symbol sm;
    +Symbol symbol_membersearch(Symbol[] table, char[] id)
    +{   Symbol sm;
     
    -	void membersearchx(Symbol s)
    +    void membersearchx(Symbol s)
    +    {
    +	while (s)
     	{
    -	    while (s)
    +	    if (id == s.id)
     	    {
    -		if (id == s.id)
    -		{
    -		    if (sm)
    -			error("ambiguous member %s\n", id);
    -		    sm = s;
    -		}
    -
    -		if (s.left)
    -		    membersearchx(s.left);
    -		s = s.right;
    +		if (sm)
    +		    error("ambiguous member %s\n", id);
    +		sm = s;
     	    }
    -	}
     
    -	for (int i = 0; i < table.length; i++)
    -	{
    -	    membersearchx(table[i]);
    +	    if (s.left)
    +		membersearchx(s.left);
    +	    s = s.right;
     	}
    -	return sm;
         }
    +
    +    for (int i = 0; i < table.length; i++)
    +    {
    +	membersearchx(table[i]);
    +    }
    +    return sm;
    +}
     

    @@ -1484,22 +1395,18 @@ integral type. To produce an unsigned right shift on an int, a cast is necessary: -
    -	int i, j;
    -	...
    -	j = (unsigned)i >> 3;
    -	
    - +
    int i, j;
    +...
    +j = (unsigned)i >> 3;
    +
    If i is an int, this works fine. But if i is of a typedef'd type, -
    -	myint i, j;
    -	...
    -	j = (unsigned)i >> 3;
    -	
    - +
    myint i, j;
    +...
    +j = (unsigned)i >> 3;
    +
    and myint happens to be a long int, then the cast to unsigned @@ -1514,9 +1421,9 @@ do an unsigned right shift regardless of the sign of the left operand. Hence, -
    	myint i, j;
    -	...
    -	j = i >>> 3;
    +
    myint i, j;
    +...
    +j = i >>> 3;
     
    avoids the unsafe cast and will work as expected with any integral @@ -1539,34 +1446,32 @@ class that holds an array of int's, and a user of that container that computes the maximum of those int's. -
    -	struct Collection
    -	{
    -	    int array[10];
    -
    -	    void apply(void *p, void (*fp)(void *, int))
    -	    {
    -		for (int i = 0; i < sizeof(array)/sizeof(array[0]); i++)
    -		    fp(p, array[i]);
    -	    }
    -	};
    +
    struct Collection
    +{
    +    int array[10];
     
    -	void comp_max(void *p, int i)
    -	{
    -	    int *pmax = (int *)p;
    +    void apply(void *p, void (*fp)(void *, int))
    +    {
    +	for (int i = 0; i < sizeof(array)/sizeof(array[0]); i++)
    +	    fp(p, array[i]);
    +    }
    +};
     
    -	    if (i > *pmax)
    -		*pmax = i;
    -	}
    +void comp_max(void *p, int i)
    +{
    +    int *pmax = (int *)p;
     
    -	void func(Collection *c)
    -	{
    -	    int max = INT_MIN;
    +    if (i > *pmax)
    +	*pmax = i;
    +}
     
    -	    c->apply(&max, comp_max);
    -	}
    -	
    +void func(Collection *c) +{ + int max = INT_MIN; + c->apply(&max, comp_max); +} +
    The C way makes heavy use of pointers and casting. The casting is tedious, error prone, and loses all type safety. @@ -1578,41 +1483,41 @@ and nested functions both to capture context information and to improve locality. -
    	class Collection
    -	{
    -	    int[10] array;
    +
    class Collection
    +{
    +    int[10] array;
     
    -	    void apply(void delegate(int) fp)
    -	    {
    -		for (int i = 0; i < array.length; i++)
    -		    fp(array[i]);
    -	    }
    -	}
    +    void apply(void delegate(int) fp)
    +    {
    +	for (int i = 0; i < array.length; i++)
    +	    fp(array[i]);
    +    }
    +}
     
    -	void func(Collection c)
    -	{
    -	    int max = int.min;
    +void func(Collection c)
    +{
    +    int max = int.min;
     
    -	    void comp_max(int i)
    -	    {
    -		if (i > max)
    -		    max = i;
    -	    }
    +    void comp_max(int i)
    +    {
    +	if (i > max)
    +	    max = i;
    +    }
     
    -	    c.apply(comp_max);
    -	}
    +    c.apply(comp_max);
    +}
     
    Pointers are eliminated, as well as casting and generic pointers. The D version is fully type safe. An alternate method in D makes use of function literals: -
    	void func(Collection c)
    -	{
    -	    int max = int.min;
    +
    void func(Collection c)
    +{
    +    int max = int.min;
     
    -	    c.apply(delegate(int i) { if (i > max) max = i; } );
    -	}
    +    c.apply(delegate(int i) { if (i > max) max = i; } );
    +}
     
    eliminating the need to create irrelevant function names. @@ -1669,23 +1574,23 @@ type, and the number of arguments becomes a property of the array: -
    int sum(int[] values ...)
    +
    int sum(int[] values ...)
     {
    -    int s = 0;
    +    int s = 0;
     
    -    foreach (int x; values)
    +    foreach (int x; values)
     	s += x;
    -    return s;
    +    return s;
     }
     
    -int main()
    +int main()
     {
    -    int i;
    +    int i;
     
         i = sum(8,7,6);
    -    printf("sum = %d\n", i);
    +    printf("sum = %d\n", i);
     
    -    return 0;
    +    return 0;
     }
     
    diff -uNr dmd-0.156/dmd/html/d/dbc.html dmd-0.157/dmd/html/d/dbc.html --- dmd-0.156/dmd/html/d/dbc.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/dbc.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -189,7 +158,7 @@ assert. An assert inserts a checkable expression into the code, and that expression must evaluate to true: -
    assert(expression);
    +
    assert(expression);
     
    C programmers will find it familiar. Unlike C, however, an assert in function bodies @@ -206,15 +175,15 @@ would be in validating the return value of a function and of any side effects it has. The syntax is: -
    in
    +
    in
     {
         ...contract preconditions...
     }
    -out (result)
    +out (result)
     {
         ...contract postconditions...
     }
    -body
    +body
     {
         ...code...
     }
    @@ -228,18 +197,18 @@
     	body, the variable result is declared and assigned the return
     	value of the function.
     	For example, let's implement a square root function:
    -
    long square_root(long x)
    -    in
    +
    long square_root(long x)
    +    in
         {
    -	assert(x >= 0);
    +	assert(x >= 0);
         }
    -    out (result)
    +    out (result)
         {
    -	assert((result * result) == x);
    +	assert((result * result) == x);
         }
    -    body
    +    body
         {
    -	return math.sqrt(x);
    +	return math.sqrt(x);
         }
     
    The assert's in the in and out bodies are called contracts. @@ -254,12 +223,12 @@ If the function returns a void, there is no result, and so there can be no result declaration in the out clause. In that case, use: -
    void func()
    -   out
    +
    void func()
    +   out
        {
     	...contracts...
        }
    -   body
    +   body
        {
     	...
        }
    @@ -273,17 +242,17 @@
     

    The in-out statement can also be used inside a function, for example, it can be used to check the results of a loop: -

    in
    +
    in
     {
    -    assert(j == 0);
    +    assert(j == 0);
     }
    -out
    +out
     {
    -    assert(j == 10);
    +    assert(j == 10);
     }
    -body
    +body
     {
    -    for (i = 0; i < 10; i++)
    +    for (i = 0; i < 10; i++)
     	j++;
     }
     
    diff -uNr dmd-0.156/dmd/html/d/dcompiler.html dmd-0.157/dmd/html/d/dcompiler.html --- dmd-0.156/dmd/html/d/dcompiler.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/dcompiler.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -228,46 +197,46 @@

      -
    1. /** ... */ The two *'s after the opening / -
    2. /++ ... +/ The two +'s after the opening / -
    3. /// The three slashes +
    4. /** ... */ The two *'s after the opening / +
    5. /++ ... +/ The two +'s after the opening / +
    6. /// The three slashes

    The following are all embedded documentation comments:

    -
    /// This is a one line documentation comment.
    +
    /// This is a one line documentation comment.
     
    -/** So is this. */
    +/** So is this. */
     
    -/++ And this. +/
    +/++ And this. +/
     
    -/**
    +/**
        This is a brief documentation comment.
      */
     
    -/**
    +/**
      * The leading * on this line is not part of the documentation comment.
      */
     
    -/*********************************
    +/*********************************
        The extra *'s immediately following the /** are not
        part of the documentation comment.
      */
     
    -/++
    +/++
        This is a brief documentation comment.
      +/
     
    -/++
    +/++
      + The leading + on this line is not part of the documentation comment.
      +/
     
    -/+++++++++++++++++++++++++++++++++
    +/+++++++++++++++++++++++++++++++++
        The extra +'s immediately following the / ++ are not
        part of the documentation comment.
      +/
     
    -/**************** Closing *'s are not part *****************/
    +/**************** Closing *'s are not part *****************/
     

    The extra *'s and +'s on the comment opening, closing and left margin are @@ -302,33 +271,33 @@ put an empty declaration comment for it.

    -
    int a;  /// documentation for a; b has no documentation
    -int b;
    +
    int a;  /// documentation for a; b has no documentation
    +int b;
     
    -/** documentation for c and d */
    -/** more documentation for c and d */
    -int c;
    -/** ditto */
    -int d;
    +/** documentation for c and d */
    +/** more documentation for c and d */
    +int c;
    +/** ditto */
    +int d;
     
    -/** documentation for e and f */ int e;
    -int f;	/// ditto
    +/** documentation for e and f */ int e;
    +int f;	/// ditto
     
    -/** documentation for g */
    -int g; /// more documentation for g
    +/** documentation for g */
    +int g; /// more documentation for g
     
    -/// documentation for C and D
    -class C
    +/// documentation for C and D
    +class C
     {
    -    int x;    /// documentation for C.x
    +    int x;    /// documentation for C.x
     
    -    /** documentation for C.y and C.z */
    -    int y;
    -    int z;    /// ditto
    +    /** documentation for C.y and C.z */
    +    int y;
    +    int z;    /// ditto
     }
     
    -/// ditto
    -class D
    +/// ditto
    +class D
     {
     }
     
    @@ -360,7 +329,7 @@ there cannot be a Description without a Summary section.

    -
    /***********************************
    +
    /***********************************
      * Brief summary of what
      * myfunc does, forming the summary section.
      *
    @@ -370,7 +339,7 @@
      * synopsis description.
      */
     
    -void myfunc() { }
    +void myfunc() { }
     

    Named sections follow the Summary and Description unnamed sections. @@ -386,14 +355,14 @@

    Authors:
    Lists the author(s) of the declaration. -
    /**
    +
    /**
      * Authors: Melvin D. Nerd, melvin@mailinator.com
      */
     
    Bugs:
    Lists any known bugs. -
    /**
    +
    /**
      * Bugs: Doesn't work for negative values.
      */
     
    @@ -402,7 +371,7 @@
    Specifies the date of the current revision. The date should be in a form parseable by std.date. -
    /**
    +
    /**
      * Date: March 14, 2003
      */
     
    @@ -411,16 +380,16 @@
    Provides an explanation for and corrective action to take if the associated declaration is marked as deprecated. -
    /**
    +
    /**
      * Deprecated: superseded by function bar().
      */
     
    -deprecated void foo() { ... }
    +deprecated void foo() { ... }
     
    Examples:
    Any usage examples -
    /**
    +
    /**
      * Examples:
      * --------------------
      * writefln("3"); // writes '3' to stdout
    @@ -430,7 +399,7 @@
     
     
    History:
    Revision history. -
    /**
    +
    /**
      * History:
      *	V1 is initial version
      *
    @@ -440,27 +409,27 @@
     
     
    License:
    Any license information for copyrighted code. -
    /**
    +
    /**
      * License: use freely for any purpose
      */
     
    -void bar() { ... }
    +void bar() { ... }
     
    Returns:
    Explains the return value of the function. If the function returns void, don't redundantly document it. -
    /**
    +
    /**
      * Read the file.
      * Returns: The contents of the file.
      */
     
    -void[] readFile(char[] filename) { ... }
    +void[] readFile(char[] filename) { ... }
     
    See_Also:
    List of other symbols and URL's to related items. -
    /**
    +
    /**
      * See_Also:
      *    foo, bar, http://www.digitalmars.com/d/phobos/index.html
      */
    @@ -469,24 +438,24 @@
     
    Standards:
    If this declaration is compliant with any particular standard, the description of it goes here. -
    /**
    +
    /**
      * Standards: Conforms to DSPEC-1234
      */
     
    Throws:
    Lists exceptions thrown and under what circumstances they are thrown. -
    /**
    +
    /**
      * Write the file.
      * Throws: WriteException on failure.
      */
     
    -void writeFile(char[] filename) { ... }
    +void writeFile(char[] filename) { ... }
     
    Version:
    Specifies the current version of the declaration. -
    /**
    +
    /**
      * Version: 1.6a
      */
     
    @@ -505,9 +474,9 @@ The copyright section only gets this special treatment when it is for the module declaration. -
    /** Copyright: Public Domain */
    +
    /** Copyright: Public Domain */
     
    -module foo;
    +module foo;
     
    Params: @@ -516,7 +485,7 @@ an '=' starts a new parameter description. A description can span multiple lines. -
    /***********************************
    +
    /***********************************
      * foo does this.
      * Params:
      *	x =	is for this
    @@ -524,7 +493,7 @@
      *	y =	is for that
      */
     
    -void foo(int x, int y)
    +void foo(int x, int y)
     {
     }
     
    @@ -534,7 +503,7 @@ It's a series of NAME=value pairs. The NAME is the macro name, and value is the replacement text. -
    /**
    +
    /**
      * Macros:
      *	FOO =	now is the time for
      *		all good men
    @@ -559,7 +528,7 @@
     	them to delineate the code section:
     

    -
     /++++++++++++++++++++++++
    +
     /++++++++++++++++++++++++
       + Our function.
       + Example:
       + --------------------------
    @@ -586,7 +555,7 @@
     best to avoid using it where practical.
     

    -
    /** Example of embedded HTML:
    +
    /** Example of embedded HTML:
      *   <ol>
      *      <li> <a href="www.digitalmars.com">Digital Mars</a>
      *      <li> <a href="www.classicempire.com">Empire</a>
    @@ -968,6 +937,15 @@
     	generated by Ddoc.
     

    +

    References

    + +

    CandyDoc + is a very nice example of how + one can customize the Ddoc results with macros + and style sheets. +

    + +



    diff -uNr dmd-0.156/dmd/html/d/declaration.html dmd-0.157/dmd/html/d/declaration.html --- dmd-0.156/dmd/html/d/declaration.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/declaration.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -241,7 +210,8 @@ TemplateInstance . IdentifierList Typeof: - typeof ( Expression ) + typeof ( + Expression ) StorageClasses: StorageClass @@ -264,11 +234,14 @@ Declarator2: BasicType2 Declarator2 - ( Declarator2 ) - ( Declarator2 ) DeclaratorSuffixes + ( + Declarator2 ) + ( + Declarator2 ) DeclaratorSuffixes Parameters: - ( ParameterList ) + ( + ParameterList ) ( ) ParameterList: @@ -328,42 +301,42 @@

    Declaration syntax generally reads right to left:

    -
    int x;		// x is an int
    -int* x;		// x is a pointer to int
    -int** x;	// x is a pointer to a pointer to int
    -int[] x;	// x is an array of ints
    -int*[] x;	// x is an array of pointers to ints
    -int[]* x;	// x is a pointer to an array of ints
    +
    int x;		// x is an int
    +int* x;		// x is a pointer to int
    +int** x;	// x is a pointer to a pointer to int
    +int[] x;	// x is an array of ints
    +int*[] x;	// x is an array of pointers to ints
    +int[]* x;	// x is a pointer to an array of ints
     

    Arrays read right to left as well:

    -
    int[3] x;	// x is an array of 3 ints
    -int[3][5] x;	// x is an array of 5 arrays of 3 ints
    -int[3]*[5] x;	// x is an array of 5 pointers to arrays of 3 ints
    +
    int[3] x;	// x is an array of 3 ints
    +int[3][5] x;	// x is an array of 5 arrays of 3 ints
    +int[3]*[5] x;	// x is an array of 5 pointers to arrays of 3 ints
     

    Pointers to functions are declared using the function keyword:

    -
    int function(char) x;   // x is a pointer to a function taking a char argument
    -			// and returning an int
    -int function(char)[] x; // x is an array of pointers to functions
    -			// taking a char argument and returning an int
    +
    int function(char) x;   // x is a pointer to a function taking a char argument
    +			// and returning an int
    +int function(char)[] x; // x is an array of pointers to functions
    +			// taking a char argument and returning an int
     

    C-style array declarations may be used as an alternative:

    -
    int x[3];	   // x is an array of 3 ints
    -int x[3][5];	   // x is an array of 3 arrays of 5 ints
    -int (*x[5])[3];	   // x is an array of 5 pointers to arrays of 3 ints
    -int (*x)(char);	   // x is a pointer to a function taking a char argument
    -		   // and returning an int
    -int (*[] x)(char); // x is an array of pointers to functions
    -		   // taking a char argument and returning an int
    +
    int x[3];	   // x is an array of 3 ints
    +int x[3][5];	   // x is an array of 3 arrays of 5 ints
    +int (*x[5])[3];	   // x is an array of 5 pointers to arrays of 3 ints
    +int (*x)(char);	   // x is a pointer to a function taking a char argument
    +		   // and returning an int
    +int (*[] x)(char); // x is an array of pointers to functions
    +		   // taking a char argument and returning an int
     

    @@ -371,11 +344,11 @@ must be of the same type:

    -
    int x,y;	// x and y are ints
    -int* x,y;	// x and y are pointers to ints
    -int x,*y;	// error, multiple types
    -int[] x,y;	// x and y are arrays of ints
    -int x[],y;	// error, multiple types
    +
    int x,y;	// x and y are ints
    +int* x,y;	// x and y are pointers to ints
    +int x,*y;	// error, multiple types
    +int[] x,y;	// x and y are arrays of ints
    +int x[],y;	// error, multiple types
     

    Implicit Type Inference

    @@ -384,13 +357,13 @@ an Initializer from which the type can be inferred, the type on the declaration can be omitted. -
    static x = 3;	   // x is type int
    -auto y = 4u;	   // y is type uint
    -auto s = "string"; // s is type char[6]
    +
    static x = 3;	   // x is type int
    +auto y = 4u;	   // y is type uint
    +auto s = "string"; // s is type char[6]
     
    -class C { ... }
    +class C { ... }
     
    -auto c = new C();  // c is a handle to an instance of class C
    +auto c = new C();  // c is a handle to an instance of class C
     
    The Initializer cannot contain forward references @@ -401,10 +374,10 @@ An implicit type inference for a class reference is not an auto declaration, even if the auto storage class is used: -
    class C { ... }
    +
    class C { ... }
     
    -auto c = new C();   // c is not RAII
    -auto C d = new C(); // c is automatically destructed at the end of its scope
    +auto c = new C();   // c is not RAII
    +auto C d = new C(); // c is automatically destructed at the end of its scope
     
    @@ -415,21 +388,21 @@ distinct type to the type checking system, for function overloading, and for the debugger.

    -
    typedef int myint;
    +
    typedef int myint;
     
    -void foo(int x) { . }
    -void foo(myint m) { . }
    +void foo(int x) { . }
    +void foo(myint m) { . }
     
      .
     myint b;
    -foo(b);	        // calls foo(myint)
    +foo(b);	        // calls foo(myint)
     
    Typedefs can specify a default initializer different from the default initializer of the underlying type: -
    typedef int myint = 7;
    -myint m;        // initialized to 7
    +
    typedef int myint = 7;
    +myint m;        // initialized to 7
     
    @@ -441,7 +414,7 @@ alias declaration:

    -
    alias abc.Foo.bar myint;
    +
    alias abc.Foo.bar myint;
     

    @@ -450,10 +423,10 @@ overloading is concerned. For example:

    -
    alias int myint;
    +
    alias int myint;
     
    -void foo(int x) { . }
    -void foo(myint m) { . }	// error, multiply defined function foo
    +void foo(int x) { . }
    +void foo(myint m) { . }	// error, multiply defined function foo
     

    @@ -467,27 +440,27 @@ For example:

    -
    import string;
    +
    import string;
     
    -alias string.strlen mylen;
    +alias string.strlen mylen;
      ...
    -int len = mylen("hello");	// actually calls string.strlen()
    +int len = mylen("hello");	// actually calls string.strlen()
     

    The following alias declarations are valid:

    -
    template Foo2(T) { alias T t; }
    -alias Foo2!(int) t1;
    -alias Foo2!(int).t t2;
    -alias t1.t t3;
    -alias t2 t4;
    -
    -t1.t v1;	// v1 is type int
    -t2 v2;		// v2 is type int
    -t3 v3;		// v3 is type int
    -t4 v4;		// v4 is type int
    +
    template Foo2(T) { alias T t; }
    +alias Foo2!(int) t1;
    +alias Foo2!(int).t t2;
    +alias t1.t t3;
    +alias t2 t4;
    +
    +t1.t v1;	// v1 is type int
    +t2 v2;		// v2 is type int
    +t3 v3;		// v3 is type int
    +t4 v4;		// v4 is type int
     

    @@ -496,13 +469,13 @@ to another:

    -
    version (Win32)
    +
    version (Win32)
     {
    -    alias win32.foo myfoo;
    +    alias win32.foo myfoo;
     }
    -version (linux)
    +version (linux)
     {
    -    alias linux.bar myfoo;
    +    alias linux.bar myfoo;
     }
     
    @@ -511,7 +484,7 @@ current scope:

    -
    alias string.strlen strlen;
    +
    alias string.strlen strlen;
     

    @@ -519,30 +492,30 @@ be overloaded with functions in the current scope:

    -
    class A {
    -    int foo(int a) { return 1; }
    +
    class A {
    +    int foo(int a) { return 1; }
     }
     
    -class B : A {
    -    int foo( int a, uint b ) { return 2; }
    +class B : A {
    +    int foo( int a, uint b ) { return 2; }
     }
     
    -class C : B {
    -    int foo( int a ) { return 3; }
    -    alias B.foo foo;
    +class C : B {
    +    int foo( int a ) { return 3; }
    +    alias B.foo foo;
     }
     
    -class D : C  {
    +class D : C  {
     }
     
     
    -void test()
    +void test()
     {
    -    D b = new D();
    -    int i;
    +    D b = new D();
    +    int i;
     
    -    i = b.foo(1, 2u);	// calls B.foo
    -    i = b.foo(1);	// calls C.foo
    +    i = b.foo(1, 2u);	// calls B.foo
    +    i = b.foo(1);	// calls C.foo
     }
     
    @@ -551,7 +524,7 @@ alias declarations:

    -
    alias foo.bar abc;	// is it a type or a symbol?
    +
    alias foo.bar abc;	// is it a type or a symbol?
     

    @@ -574,15 +547,15 @@ of an expression. For example:

    -
    void func(int i)
    +
    void func(int i)
     {
    -    typeof(i) j;	// j is of type int
    -    typeof(3 + 6.0) x;	// x is of type double
    -    typeof(1)* p;	// p is of type pointer to int
    -    int[typeof(p)] a;	// a is of type int[int*]
    +    typeof(i) j;	// j is of type int
    +    typeof(3 + 6.0) x;	// x is of type double
    +    typeof(1)* p;	// p is of type pointer to int
    +    int[typeof(p)] a;	// a is of type int[int*]
     
    -    printf("%d\n", typeof('c').sizeof);	// prints 1
    -    double c = cast(typeof(1.0))j;	// cast j to double
    +    printf("%d\n", typeof('c').sizeof);	// prints 1
    +    double c = cast(typeof(1.0))j;	// cast j to double
     }
     
    @@ -591,10 +564,10 @@ generated:

    -
    void func()
    -{   int i = 1;
    -    typeof(++i) j;	// j is declared to be an int, i is not incremented
    -    printf("%d\n", i);	// prints 1
    +
    void func()
    +{   int i = 1;
    +    typeof(++i) j;	// j is declared to be an int, i is not incremented
    +    printf("%d\n", i);	// prints 1
     }
     
    @@ -607,21 +580,21 @@ super would be in a non-static member function.

    -
    class A { }
    +
    class A { }
     
    -class B : A
    +class B : A
     {
    -    typeof(this) x;	// x is declared to be a B
    -    typeof(super) y;	// y is declared to be an A
    +    typeof(this) x;	// x is declared to be a B
    +    typeof(super) y;	// y is declared to be an A
     }
     
    -struct C
    +struct C
     {
    -    typeof(this) z;	// z is declared to be a C*
    -    typeof(super) q;	// error, no super struct for C
    +    typeof(this) z;	// z is declared to be a C*
    +    typeof(super) q;	// error, no super struct for C
     }
     
    -typeof(this) r;		// error, no enclosing struct or class
    +typeof(this) r;		// error, no enclosing struct or class
     

    @@ -637,10 +610,10 @@ however, the variable is not initialized. If its value is used before it is set, undefined program behavior will result. -

    void foo()
    +
    void foo()
     {
    -    int x = void;
    -    writefln(x);	// will print garbage
    +    int x = void;
    +    writefln(x);	// will print garbage
     }
     
    diff -uNr dmd-0.156/dmd/html/d/dlinks.html dmd-0.157/dmd/html/d/dlinks.html --- dmd-0.156/dmd/html/d/dlinks.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/dlinks.html 2006-05-08 15:25:42.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -56,137 +56,101 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -

    D + Links

    Wikis

    @@ -259,6 +223,7 @@
  • Program editors customized for use with D + .
  • Build @@ -269,6 +234,11 @@
  • The Ragel State Machine Compiler compiles finite state machines from regular languages into executable D code. + +
  • CandyDoc + shows how one can customize the Ddoc results with macros + and style sheets. +
  • Libraries

    @@ -352,27 +322,42 @@ -

    Forums, Blogs

    +

    Forums, Blogs, Journals

    -
    • Lars Ivar Igesund's D blog
    • . +

      Miscellaneous

      @@ -410,6 +397,11 @@
    • Ben Hinkle's D page contains several D-related projects. +
    • DMedia is dedicated to + multimedia development with D. It will include 2d and 3d graphics, sound + programming and probably more.
    • + +
    • Check for a D user's group in your community. @@ -421,11 +413,13 @@
    • Why D + isn't Java? By Daniel Yokomiso.
    • Burton Radons has prepared a linux port of D + . This is a very useful guide for anyone wanting to build a new code generator for D for a different processor. @@ -435,8 +429,10 @@
    • Pavel's DedicateD site. Lots of D + projects with source code, FAQs, D + news, etc.
    • @@ -445,11 +441,13 @@
    • Gnu D + compiler project on SourceForge.
    • The D + Journal (coming soon!)
      @@ -498,6 +496,7 @@
    • MKoD - D + Programming Language (MKoD == Magikal Kingdom of Dreams)
      Always expanding, currently the site contains projects @@ -525,6 +524,11 @@
    • Unsorted D links.
    • +
    • Gnu-D, GNU for the D language
    • + +
    • Walter Bright's SDWest 2004 + + presentation on D.

    Japanese Language

    @@ -582,6 +586,7 @@ Cut & paste the following free images on your web pages of interest to D + programmers:

    @@ -603,15 +608,18 @@ Corto's D + button images: D Language

    Submissions

    If you have any D + code, documents, images or web pages of interest to D + programmers, please email diff -uNr dmd-0.156/dmd/html/d/dll.html dmd-0.157/dmd/html/d/dll.html --- dmd-0.156/dmd/html/d/dll.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/dll.html 2006-05-08 15:25:44.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -56,131 +56,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -165,8 +134,7 @@
    - - diff -uNr dmd-0.156/dmd/html/d/garbage.html dmd-0.157/dmd/html/d/garbage.html --- dmd-0.156/dmd/html/d/garbage.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/garbage.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    diff -uNr dmd-0.156/dmd/html/d/html.html dmd-0.157/dmd/html/d/html.html --- dmd-0.156/dmd/html/d/html.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/html.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -222,9 +185,9 @@ Generally, surround the entire module with: -
    extern (C)
    +
    extern (C)
     {
    -     /* ...file contents... */
    +     /* ...file contents... */
     }
     
    @@ -237,8 +200,7 @@ for 32 bit C code:

    -

    Name Value Symbol + @@ -203,12 +166,12 @@ For example, if there's a Mutex m that must be acquired and held for a few statements, then released: -
    void abc()
    +
    void abc()
     {
    -    Mutex m = new Mutex;
    -    lock(m);	// lock the mutex
    -    foo();	// do processing
    -    unlock(m);	// unlock the mutex
    +    Mutex m = new Mutex;
    +    lock(m);	// lock the mutex
    +    foo();	// do processing
    +    unlock(m);	// unlock the mutex
     }
     
    @@ -226,27 +189,27 @@ a Lock class with a destructor that gets called upon the exit of the scope:

    -
    class Lock
    +
    class Lock
     {
         Mutex m;
     
    -    this(Mutex m)
    +    this(Mutex m)
         {
    -	this.m = m;
    +	this.m = m;
     	lock(m);
         }
     
    -    ~this()
    +    ~this()
         {
     	unlock(m);
         }
     }
     
    -void abc()
    +void abc()
     {
    -    Mutex m = new Mutex;
    -    auto Lock L = new Lock(m);
    -    foo();	// do processing
    +    Mutex m = new Mutex;
    +    auto Lock L = new Lock(m);
    +    foo();	// do processing
     }
     
    @@ -254,17 +217,17 @@ its destructor called and the mutex is unlocked. The try-finally solution to the same problem looks like: -
    void abc()
    +
    void abc()
     {
    -    Mutex m = new Mutex;
    -    lock(m);	// lock the mutex
    -    try
    +    Mutex m = new Mutex;
    +    lock(m);	// lock the mutex
    +    try
         {
    -	foo();	// do processing
    +	foo();	// do processing
         }
    -    finally
    +    finally
         {
    -	unlock(m);	// unlock the mutex
    +	unlock(m);	// unlock the mutex
         }
     }
     
    @@ -285,18 +248,18 @@ approach:

    -
    void abc()
    +
    void abc()
     {
    -    Mutex m = new Mutex;
    +    Mutex m = new Mutex;
     
    -    lock(m);	// lock the mutex
    -    scope(exit) unlock(m);	// unlock on leaving the scope
    +    lock(m);	// lock the mutex
    +    scope(exit) unlock(m);	// unlock on leaving the scope
     
    -    foo();	// do processing
    +    foo();	// do processing
     }
     
    -The scope(exit) statement is executed at the closing curly +The scope(exit) statement is executed at the closing curly brace upon normal execution, or when the scope is left due to an exception having been thrown. @@ -317,7 +280,7 @@ f = dofoo(); b = dobar(); - return Transaction(f, b); + return Transaction(f, b); }
    @@ -331,29 +294,29 @@

    With the RAII approach:

    -
    class FooX
    +
    class FooX
     {
         Foo f;
    -    bool commit;
    +    bool commit;
     
    -    this()
    +    this()
         {
     	f = dofoo();
         }
     
    -    ~this()
    +    ~this()
         {
    -	if (!commit)
    +	if (!commit)
     	    dofoo_undo(f);
         }
     }
     
     Transaction abc()
     {
    -    auto FooX f = new FooX();
    +    auto FooX f = new FooX();
         Bar b = dobar();
    -    f.commit = true;
    -    return Transaction(f.f, b);
    +    f.commit = true;
    +    return Transaction(f.f, b);
     }
     
    @@ -365,15 +328,15 @@ Bar b; f = dofoo(); - try + try { b = dobar(); - return Transaction(f, b); + return Transaction(f, b); } - catch (Object o) + catch (Object o) { dofoo_undo(f); - throw o; + throw o; } }
    @@ -386,7 +349,7 @@ must succeed. It scales poorly.

    -

    The scope(failure) statement solution looks like: +

    The scope(failure) statement solution looks like:

    Transaction abc()
    @@ -395,11 +358,11 @@
         Bar b;
     
         f = dofoo();
    -    scope(failure) dofoo_undo(f);
    +    scope(failure) dofoo_undo(f);
     
         b = dobar();
     
    -    return Transaction(f, b);
    +    return Transaction(f, b);
     }
     
    @@ -415,14 +378,14 @@ Def d; f = dofoo(); - scope(failure) dofoo_undo(f); + scope(failure) dofoo_undo(f); b = dobar(); - scope(failure) dobar_unwind(b); + scope(failure) dobar_unwind(b); d = dodef(); - return Transaction(f, b, d); + return Transaction(f, b, d); }
    @@ -434,14 +397,14 @@ Inside one of the methods, verbose needs to be turned off because there's a loop that would otherwise cause a blizzard of messages to be output: -
    class Foo
    +
    class Foo
     {
    -    bool verbose;	// true means print messages, false means silence
    +    bool verbose;	// true means print messages, false means silence
         ...
         bar()
         {
    -	auto verbose_save = verbose;
    -	verbose = false;
    +	auto verbose_save = verbose;
    +	verbose = false;
     	... lots of code ...
     	verbose = verbose_save;
         }
    @@ -450,17 +413,17 @@
     
     There's a problem if Foo.bar() exits via an exception - the verbose
     flag state is not restored.
    -That's easilly fixed with scope(exit):
    +That's easilly fixed with scope(exit):
     
    -
    class Foo
    +
    class Foo
     {
    -    bool verbose;	// true means print messages, false means silence
    +    bool verbose;	// true means print messages, false means silence
         ...
         bar()
         {
    -	auto verbose_save = verbose;
    -	verbose = false;
    -	scope(exit) verbose = verbose_save;
    +	auto verbose_save = verbose;
    +	verbose = false;
    +	scope(exit) verbose = verbose_save;
     
     	...lots of code...
         }
    @@ -521,19 +484,19 @@
     
     
     
    -
    class Mailer
    +
    class Mailer
     {
    -    void Send(Message msg)
    +    void Send(Message msg)
         {
     	{
    -	    char[] origTitle = msg.Title();
    -	    scope(exit) msg.SetTitle(origTitle);
    -	    msg.SetTitle("[Sending] " ~ origTitle);
    -	    Copy(msg, "Sent");
    +	    char[] origTitle = msg.Title();
    +	    scope(exit) msg.SetTitle(origTitle);
    +	    msg.SetTitle("[Sending] " ~ origTitle);
    +	    Copy(msg, "Sent");
     	}
    -	scope(success) SetTitle(msg.ID(), "Sent", msg.Title);
    -	scope(failure) Remove(msg.ID(), "Sent");
    -	SmtpSend(msg);	// do the least reliable part last
    +	scope(success) SetTitle(msg.ID(), "Sent", msg.Title);
    +	scope(failure) Remove(msg.ID(), "Sent");
    +	SmtpSend(msg);	// do the least reliable part last
         }
     }
     
    @@ -549,27 +512,27 @@ Consider giving feedback to the user about a lengthy operation (mouse changes to an hourglass, window title is red/italicized, ...). -With scope(exit) that can be easilly done without +With scope(exit) that can be easilly done without needing to make an artificial resource out of whatever UI state element used for the cues: -
    void LongFunction()
    +
    void LongFunction()
     {
         State save = UIElement.GetState();
    -    scope(exit) UIElement.SetState(save);
    +    scope(exit) UIElement.SetState(save);
         ...lots of code...
     }
     
    -Even more so, scope(success) and scope(failure) +Even more so, scope(success) and scope(failure) can be used to give an indication if the operation succeeded or if an error occurred: -
    void LongFunction()
    +
    void LongFunction()
     {
         State save = UIElement.GetState();
    -    scope(success) UIElement.SetState(save);
    -    scope(failure) UIElement.SetState(Failed(save));
    +    scope(success) UIElement.SetState(save);
    +    scope(failure) UIElement.SetState(Failed(save));
         ...lots of code...
     }
     
    diff -uNr dmd-0.156/dmd/html/d/expression.html dmd-0.157/dmd/html/d/expression.html --- dmd-0.156/dmd/html/d/expression.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/expression.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    Name Value Symbol
    quot 34 "
    amp 38 & diff -uNr dmd-0.156/dmd/html/d/enum.html dmd-0.157/dmd/html/d/enum.html --- dmd-0.156/dmd/html/d/enum.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/enum.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -197,19 +166,19 @@ It must be an integral type. If omitted, it defaults to int. -
    enum { A, B, C }	// anonymous enum
    +
    enum { A, B, C }	// anonymous enum
     
    Defines the constants A=0, B=1, C=2 in a manner equivalent to: -
    const int A = 0;
    -const int B = 1;
    -const int C = 2;
    +
    const int A = 0;
    +const int B = 1;
    +const int C = 2;
     
    Whereas: -
    enum X { A, B, C }	// named enum
    +
    enum X { A, B, C }	// named enum
     
    Define a new type X which has values X.A=0, X.B=1, X.C=2 @@ -228,7 +197,7 @@ Subsequent enum members with no Expression are set to the value of the previous member plus one: -
    enum { A, B = 5+7, C, D = 8, E }
    +
    enum { A, B = 5+7, C, D = 8, E }
     
    Sets A=0, B=12, C=13, D=8, and E=9. @@ -252,8 +221,8 @@ In the absence of an explicit initializer, an enum variable is initialized to the first enum value. -
    enum X { A=3, B, C }
    -X x;		// x is initialized to 3
    +
    enum X { A=3, B, C }
    +X x;		// x is initialized to 3
     
    diff -uNr dmd-0.156/dmd/html/d/errors.html dmd-0.157/dmd/html/d/errors.html --- dmd-0.156/dmd/html/d/errors.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/errors.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -159,6 +128,7 @@ I came, I coded, I crashed. -- Julius C'ster + All programs have to deal with errors. Errors are unexpected conditions that are not part of the normal operation of a program. Examples of common errors are: diff -uNr dmd-0.156/dmd/html/d/exception-safe.html dmd-0.157/dmd/html/d/exception-safe.html --- dmd-0.156/dmd/html/d/exception-safe.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/exception-safe.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -264,11 +233,14 @@ NewExpression CastExpression NewAnonClassExpression - ( Type ) . Identifier - ( Expression ) + ( + Type ) . Identifier + ( + Expression ) CastExpression: - cast ( Type ) UnaryExpression + cast ( + Type ) UnaryExpression PostfixExpression: PrimaryExpression @@ -276,7 +248,8 @@ PostfixExpression ++ PostfixExpression -- PostfixExpression ( ) - PostfixExpression ( ArgumentList ) + PostfixExpression ( + ArgumentList ) IndexExpression SliceExpression @@ -301,7 +274,8 @@ FunctionLiteral AssertExpression BasicType . Identifier - typeid ( Type ) + typeid ( + Type ) IsExpression StringLiterals: @@ -309,7 +283,8 @@ StringLiterals StringLiteral AssertExpression: - assert ( Expression ) + assert ( + Expression ) ArgumentList: AssignExpression @@ -317,17 +292,20 @@ NewExpression: NewArguments Type [ AssignExpression ] - NewArguments Type ( ArgumentList ) + NewArguments Type ( + ArgumentList ) NewArguments Type NewArguments ClassArguments BaseClasslistopt { DeclDefs } NewArguments: - new ( ArgumentList ) + new ( + ArgumentList ) new ( ) new ClassArguments: - class ( ArgumentList ) + class ( + ArgumentList ) class ( ) class @@ -716,9 +694,9 @@ An associative array can be tested to see if an element is in the array: -
    int foo[char[]];
    +
    int foo[char[]];
     ...
    -if ("hello" in foo)
    +if ("hello" in foo)
     	...
     
    @@ -750,8 +728,8 @@ It's illegal to shift by more bits than the size of the quantity being shifted: -
    int c;
    -c << 33;	// error
    +
    int c;
    +c << 33;	// error
     

    Add Expressions

    @@ -783,8 +761,8 @@ 8 is non-zero.
    bit* p;
    -p += 1;		// error, 1%8 is non-zero
    -p += 8;		// ok
    +p += 1;		// error, 1%8 is non-zero
    +p += 8;		// ok
     
    If the second operand is a pointer, and the first is an integral type, @@ -834,9 +812,12 @@ ~ UnaryExpression delete UnaryExpression NewExpression -cast ( Type ) UnaryExpression -( Type ) . Identifier -( Expression ) +cast ( + Type ) UnaryExpression +( + Type ) . Identifier +( + Expression )
    @@ -849,12 +830,13 @@ To allocate multidimensional arrays, the declaration reads in the same order as the prefix array declaration order. -
    char[][] foo;	// dynamic array of strings
    +
    char[][] foo;	// dynamic array of strings
     ...
    -foo = new char[][30];	// allocate array of 30 strings
    +foo = new char[][30];	// allocate array of 30 strings
     
    - If there is a new ( ArgumentList ), then + If there is a new ( + ArgumentList ), then those arguments are passed to the class or struct specific allocator function after the size argument. @@ -892,8 +874,8 @@ A CastExpression converts the UnaryExpression to Type. -
    cast(foo) -p;	// cast (-p) to type foo
    -(foo) - p;	// subtract p from foo
    +
    cast(foo) -p;	// cast (-p) to type foo
    +(foo) - p;	// subtract p from foo
     
    Any casting of a class reference to a @@ -902,28 +884,28 @@ Note: This is equivalent to the behavior of the dynamic_cast operator in C++. -
    class A { ... }
    -class B : A { ... }
    +
    class A { ... }
    +class B : A { ... }
     
    -void test(A a, B b)
    +void test(A a, B b)
     {
    -     B bx = a;		// error, need cast
    -     B bx = cast(B) a;	// bx is null if a is not a B
    -     A ax = b;		// no cast needed
    -     A ax = cast(A) b;	// no runtime check needed for upcast
    +     B bx = a;		// error, need cast
    +     B bx = cast(B) a;	// bx is null if a is not a B
    +     A ax = b;		// no cast needed
    +     A ax = cast(A) b;	// no runtime check needed for upcast
     }
     
    In order to determine if an object o is an instance of a class B use a cast: -
    if (cast(B) o)
    +
    if (cast(B) o)
     {
    -    // o is an instance of B
    +    // o is an instance of B
     }
    -else
    +else
     {
    -    // o is not an instance of B
    +    // o is not an instance of B
     }
     
    @@ -931,19 +913,19 @@ changes its type, but internally it is retained at full precision for the purposes of constant folding. -
    void test()
    +
    void test()
     {
    -    real a = 3.40483L;
    -    real b;
    -    b = 3.40483;         // literal is not truncated to double precision
    -    assert(a == b);
    -    assert(a == 3.40483);
    -    assert(a == 3.40483L);
    -    assert(a == 3.40483F);
    -    double d = 3.40483;	// truncate literal when assigned to variable
    -    assert(d != a);     // so it is no longer the same
    -    const double x = 3.40483; // assignment to const is not
    -    assert(x == a);           // truncated if the initializer is visible
    +    real a = 3.40483L;
    +    real b;
    +    b = 3.40483;         // literal is not truncated to double precision
    +    assert(a == b);
    +    assert(a == 3.40483);
    +    assert(a == 3.40483L);
    +    assert(a == 3.40483F);
    +    double d = 3.40483;	// truncate literal when assigned to variable
    +    assert(d != a);     // so it is no longer the same
    +    const double x = 3.40483; // assignment to const is not
    +    assert(x == a);           // truncated if the initializer is visible
     }
     
    @@ -953,7 +935,8 @@ PostfixExpression -> Identifier PostfixExpression ++ PostfixExpression -- -PostfixExpression ( ArgumentList ) +PostfixExpression ( + ArgumentList ) PostfixExpression [ ArgumentList ] PostfixExpression [ AssignExpression .. AssignExpression ]
    @@ -1007,7 +990,8 @@ FunctionLiteral AssertExpression BasicType . Identifier -typeid ( Type ) +typeid ( + Type )

    .Identifier

    @@ -1022,25 +1006,25 @@ If a member function is called with an explicit reference to typeof(this), a non-virtual call is made: -
    class A
    +
    class A
     {
    -    char get() { return 'A'; }
    +    char get() { return 'A'; }
     
    -    char foo() { return typeof(this).get(); }
    -    char bar() { return this.get(); }
    +    char foo() { return typeof(this).get(); }
    +    char bar() { return this.get(); }
     }
     
    -class B : A
    +class B : A
     {
    -    char get() { return 'B'; }
    +    char get() { return 'B'; }
     }
     
    -void main()
    +void main()
     {
    -    B b = new B();
    +    B b = new B();
     
    -    b.foo();		// returns 'A'
    -    b.bar();		// returns 'B'
    +    b.foo();		// returns 'A'
    +    b.bar();		// returns 'B'
     }
     
    @@ -1101,11 +1085,11 @@ For example: -
    int function(char c) fp;	// declare pointer to a function
    +
    int function(char c) fp;	// declare pointer to a function
     
    -void test()
    +void test()
     {
    -    static int foo(char c) { return 6; }
    +    static int foo(char c) { return 6; }
     
         fp = &foo;
     }
    @@ -1113,21 +1097,21 @@
     
     	is exactly equivalent to:
     
    -
    int function(char c) fp;
    +
    int function(char c) fp;
     
    -void test()
    +void test()
     {
    -    fp = function int(char c) { return 6;} ;
    +    fp = function int(char c) { return 6;} ;
     }
     
    And: -
    int abc(int delegate(long i));
    +
    int abc(int delegate(long i));
     
    -void test()
    -{   int b = 3;
    -    int foo(long c) { return 6 + b; }
    +void test()
    +{   int b = 3;
    +    int foo(long c) { return 6 + b; }
     
         abc(&foo);
     }
    @@ -1135,34 +1119,34 @@
     
     	is exactly equivalent to:
     
    -
    int abc(int delegate(long i));
    +
    int abc(int delegate(long i));
     
    -void test()
    -{   int b = 3;
    +void test()
    +{   int b = 3;
     
    -    abc( delegate int(long c) { return 6 + b; } );
    +    abc( delegate int(long c) { return 6 + b; } );
     }
     
    Anonymous delegates can behave like arbitrary statement literals. For example, here an arbitrary statement is executed by a loop: -
    double test()
    -{   double d = 7.6;
    -    float f = 2.3;
    +
    double test()
    +{   double d = 7.6;
    +    float f = 2.3;
     
    -    void loop(int k, int j, void delegate() statement)
    +    void loop(int k, int j, void delegate() statement)
         {
    -	for (int i = k; i < j; i++)
    +	for (int i = k; i < j; i++)
     	{
     	    statement();
     	}
         }
     
    -    loop(5, 100, delegate { d += 1; } );
    -    loop(3, 10,  delegate { f += 1; } );
    +    loop(5, 100, delegate { d += 1; } );
    +    loop(3, 10,  delegate { f += 1; } );
     
    -    return d + f;
    +    return d + f;
     }
     
    @@ -1177,7 +1161,8 @@

    Assert Expressions

    AssertExpression:
    -	assert ( Expression )
    +	assert (
    + Expression )
     
    Asserts evaluate the expression. If the result is false, @@ -1202,7 +1187,8 @@

    Typeid Expressions

    TypeidExpression:
    -    typeid ( Type )
    +    typeid (
    + Type )
     
    Returns an instance of class TypeInfo corresponding @@ -1211,12 +1197,18 @@

    IsExpression

    IsExpression:
    -	is ( Type )
    -	is ( Type : TypeSpecialization )
    -	is ( Type == TypeSpecialization )
    -	is ( Type Identifier )
    -	is ( Type Identifier : TypeSpecialization )
    -	is ( Type Identifier == TypeSpecialization )
    +	is (
    + Type )
    +	is (
    + Type : TypeSpecialization )
    +	is (
    + Type == TypeSpecialization )
    +	is (
    + Type Identifier )
    +	is (
    + Type Identifier : TypeSpecialization )
    +	is (
    + Type Identifier == TypeSpecialization )
     
     TypeSpecialization:
     	Type
    @@ -1257,42 +1249,45 @@
     
     	
      -
    1. is ( Type )
      +
    2. is ( + Type )
      The condition is satisfied if Type is semantically correct (it must be syntactically correct regardless). -
      alias int func(int);	// func is a alias to a function type
      -void foo()
      +
      alias int func(int);	// func is a alias to a function type
      +void foo()
       {
      -    if ( is(func[]) )	// not satisfied because arrays of
      -			// functions are not allowed
      -	printf("satisfied\n");
      -    else
      -	printf("not satisfied\n");
      +    if ( is(func[]) )	// not satisfied because arrays of
      +			// functions are not allowed
      +	printf("satisfied\n");
      +    else
      +	printf("not satisfied\n");
       
      -    if (is([][]))	// error, [][] is not a syntactically valid type
      +    if (is([][]))	// error, [][] is not a syntactically valid type
       	...
       }
       
      -
    3. is ( Type : TypeSpecialization )
      +
    4. is ( + Type : TypeSpecialization )
      The condition is satisfied if Type is semantically correct and it is the same as or can be implicitly converted to TypeSpecialization. TypeSpecialization is only allowed to be a Type. -
      alias short bar;
      -void foo(bar x)
      +
      alias short bar;
      +void foo(bar x)
       {
      -    if ( is(bar : int) )	// satisfied because short can be
      -				// implicitly converted to int
      -	printf("satisfied\n");
      -    else
      -	printf("not satisfied\n");
      +    if ( is(bar : int) )	// satisfied because short can be
      +				// implicitly converted to int
      +	printf("satisfied\n");
      +    else
      +	printf("not satisfied\n");
       }
       
      -
    5. is ( Type == TypeSpecialization )
      +
    6. is ( + Type == TypeSpecialization )
      The condition is satisfied if Type is semantically correct and is the same type as TypeSpecialization.

      @@ -1308,44 +1303,46 @@ delegate then the condition is satisifed if Type is one of those. -

      alias short bar;
      -typedef char foo;
      -void foo(bar x)
      +
      alias short bar;
      +typedef char foo;
      +void foo(bar x)
       {
      -    if ( is(bar == int) )	// not satisfied because short is not
      -				// the same type as int
      -	printf("satisfied\n");
      -    else
      -	printf("not satisfied\n");
      -
      -    if ( is(foo == typedef) ) // satisfied because foo is a typedef
      -	printf("satisfied\n");
      -    else
      -	printf("not satisfied\n");
      +    if ( is(bar == int) )	// not satisfied because short is not
      +				// the same type as int
      +	printf("satisfied\n");
      +    else
      +	printf("not satisfied\n");
      +
      +    if ( is(foo == typedef) ) // satisfied because foo is a typedef
      +	printf("satisfied\n");
      +    else
      +	printf("not satisfied\n");
       }
       
      -
    7. is ( Type Identifier )
      +
    8. is ( + Type Identifier )
      The condition is satisfied if Type is semantically correct. If so, Identifier is declared to be an alias of Type. -
      alias short bar;
      -void foo(bar x)
      +
      alias short bar;
      +void foo(bar x)
       {
      -    static if ( is(bar T) )
      -	alias T S;
      -    else
      -	alias long S;
      -    writefln(typeid(S));   // prints "short"
      +    static if ( is(bar T) )
      +	alias T S;
      +    else
      +	alias long S;
      +    writefln(typeid(S));   // prints "short"
       
      -    if ( is(bar T) )  // error, Identifier T form can
      -		      // only be in StaticIfConditions
      +    if ( is(bar T) )  // error, Identifier T form can
      +		      // only be in StaticIfConditions
       	...
       }
       
      -
    9. is ( Type Identifier : TypeSpecialization )
      +
    10. is ( + Type Identifier : TypeSpecialization )
      The condition is satisfied if Type is the same as or can be implicitly converted to TypeSpecialization. The Identifier is declared to be either an alias of the @@ -1353,21 +1350,21 @@ dependent on Identifier, the deduced type. TypeSpecialization is only allowed to be a Type. -
      alias short bar;
      -alias long* abc;
      -void foo(bar x, abc a)
      +
      alias short bar;
      +alias long* abc;
      +void foo(bar x, abc a)
       {
      -    static if ( is(bar T : int) )
      -	alias T S;
      -    else
      -	alias long S;
      +    static if ( is(bar T : int) )
      +	alias T S;
      +    else
      +	alias long S;
       
      -    writefln(typeid(S));	// prints "int"
      +    writefln(typeid(S));	// prints "int"
       
      -    static if ( is(abc U : U*) )
      +    static if ( is(abc U : U*) )
       	U u;
       
      -    writefln(typeid(typeof(u)));	// prints "long"
      +    writefln(typeid(typeof(u)));	// prints "long"
       }
       
      @@ -1376,7 +1373,8 @@ TemplateTypeParameterSpecialization.

      -

    11. is ( Type Identifier == TypeSpecialization )
      +
    12. is ( + Type Identifier == TypeSpecialization )
      The condition is satisfied if Type is semantically correct and is the same as TypeSpecialization. The Identifier is declared to be either an alias of the @@ -1427,16 +1425,16 @@
    the function type of the delegate
    -
    alias short bar;
    -enum E : byte { Emember }
    -void foo(bar x, abc a)
    +
    alias short bar;
    +enum E : byte { Emember }
    +void foo(bar x, abc a)
     {
    -    static if ( is(bar T == int) ) // not satisfied, short is not int
    -	alias T S;
    -    alias T U;			   // error, T is not defined
    +    static if ( is(bar T == int) ) // not satisfied, short is not int
    +	alias T S;
    +    alias T U;			   // error, T is not defined
     
    -    static if ( is(E V == enum) )  // satisified, E is an enum
    -	V x;			   // x is declared to be a byte
    +    static if ( is(E V == enum) )  // satisified, E is an enum
    +	V x;			   // x is declared to be a byte
     }
     
    diff -uNr dmd-0.156/dmd/html/d/faq.html dmd-0.157/dmd/html/d/faq.html --- dmd-0.156/dmd/html/d/faq.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/faq.html 2006-05-08 15:25:44.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -56,131 +56,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -437,17 +400,17 @@

    How do I do anonymous struct/unions in D?

    -
    struct Foo
    +
    struct Foo
     {
    -    union { int a; int b; }
    -    struct { int c; int d; }
    +    union { int a; int b; }
    +    struct { int c; int d; }
     }
     
    -void main()
    +void main()
     {
         Foo f;
     
    -    printf("Foo.sizeof = %d, a.offset = %d, b.offset = %d, c.offset = %d, d.offset = %d\n",
    +    printf("Foo.sizeof = %d, a.offset = %d, b.offset = %d, c.offset = %d, d.offset = %d\n",
     	f.sizeof,
     	0,
     	&f.b - &f.a,
    @@ -469,9 +432,9 @@
     
     	Attempting this in D, as in:
     
    -
    char[] s;
    -s = "foo";
    -printf("string = '%s'\n", s);
    +
    char[] s;
    +s = "foo";
    +printf("string = '%s'\n", s);
     
    usually results in garbage being printed, or an access violation. @@ -481,9 +444,9 @@ by a separate length value. So, strings are printf'd using the %.*s format: -
    char[] s;
    -s = "foo";
    -printf("string = '%.*s'\n", s);
    +
    char[] s;
    +s = "foo";
    +printf("string = '%.*s'\n", s);
     
    which will behave as expected. @@ -497,7 +460,7 @@ A floating point value, if no explicit initializer is given, is initialized to nan (Not A Number): -
    double d;	// d is set to double.nan
    +
    double d;	// d is set to double.nan
     
    Nan's have the interesting property in that whenever a nan is @@ -667,46 +630,46 @@ not? The answers to these questions are not easy, and can vary from machine to machine. Like register assignment, let the compiler do the optimization.

    -
    for (int i = 0; i < foo.length; i++)
    +
    for (int i = 0; i < foo.length; i++)
     
    or: -
    for (int i = 0; i < foo.length; ++i)
    +
    for (int i = 0; i < foo.length; ++i)
     
    or: -
    for (T *p = &foo[0]; p < &foo[length]; p++)
    +
    for (T *p = &foo[0]; p < &foo[length]; p++)
     
    or:
    T *end = &foo[length];
    -for (T *p = &foo[0]; p < pend; ++p)
    +for (T *p = &foo[0]; p < pend; ++p)
     
    or:
    T *end = &foo[length];
     T *p = &foo[0];
    -if (p < pend)
    +if (p < pend)
     {
    -	do
    +	do
     	{
     	...
    -	} while (++p < end);
    +	} while (++p < end);
     }
     
    and, of course, should I use size_t or int? -
    for (size_t i = 0; i < foo.length; i++)
    +
    for (size_t i = 0; i < foo.length; i++)
     
    Let the compiler pick! -
    foreach (v; foo)
    +
    foreach (v; foo)
     	...
     
    @@ -715,7 +678,7 @@ an associative array, or a struct, or a collection class. This will also avoid the common fencepost bug:

    -
    for (int i = 0; i <= foo.length; i++)
    +
    for (int i = 0; i <= foo.length; i++)
     

    And it also avoids the need to manually create a temporary if foo is a diff -uNr dmd-0.156/dmd/html/d/float.html dmd-0.157/dmd/html/d/float.html --- dmd-0.156/dmd/html/d/float.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/float.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -

    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -211,13 +180,13 @@ Imaginary literals have an i suffix: -
    ireal j = 1.3i;
    +
    ireal j = 1.3i;
     
    There is no particular complex literal syntax, just add a real and imaginary type: -
    cdouble cd = 3.6 + 4i;
    -creal c = 4.5 + 2i;
    +
    cdouble cd = 3.6 + 4i;
    +creal c = 4.5 + 2i;
     
    Complex numbers have two properties: diff -uNr dmd-0.156/dmd/html/d/function.html dmd-0.157/dmd/html/d/function.html --- dmd-0.156/dmd/html/d/function.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/function.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -167,7 +136,8 @@ OutStatement: out BlockStatement - out ( Identifier ) BlockStatement + out ( + Identifier ) BlockStatement BodyStatement: body BlockStatement @@ -197,32 +167,32 @@ derived class, unless they are also private. For example: -
    class A
    +
    class A
     {
    -    int def() { ... }
    -    final int foo() { ... }
    -    final private int bar() { ... }
    -    private int abc() { ... }
    +    int def() { ... }
    +    final int foo() { ... }
    +    final private int bar() { ... }
    +    private int abc() { ... }
     }
     
    -class B : A
    +class B : A
     {
    -    int def() { ... }	// ok, overrides A.def
    -    int foo() { ... }	// error, A.foo is final
    -    int bar() { ... }	// ok, A.bar is final private, but not virtual
    -    int abc() { ... }	// ok, A.abc is not virtual, B.abc is virtual
    +    int def() { ... }	// ok, overrides A.def
    +    int foo() { ... }	// error, A.foo is final
    +    int bar() { ... }	// ok, A.bar is final private, but not virtual
    +    int abc() { ... }	// ok, A.abc is not virtual, B.abc is virtual
     }
     
    -void test(A a)
    +void test(A a)
     {
    -    a.def();	// calls B.def
    -    a.foo();	// calls A.foo
    -    a.bar();	// calls A.bar
    -    a.abc();	// calls A.abc
    +    a.def();	// calls B.def
    +    a.foo();	// calls A.foo
    +    a.bar();	// calls A.bar
    +    a.abc();	// calls A.abc
     }
     
    -void func()
    -{   B b = new B();
    +void func()
    +{   B b = new B();
         test(b);
     }
     
    @@ -232,17 +202,17 @@ overriding function in a derived class can return a type that is derived from the type returned by the overridden function: -
    class A { }
    -class B : A { }
    +
    class A { }
    +class B : A { }
     
    -class Foo
    +class Foo
     {
    -    A test() { return null; }
    +    A test() { return null; }
     }
     
    -class Bar : Foo
    +class Bar : Foo
     {
    -    B test() { return null; }	// overrides and is covariant with Foo.test()
    +    B test() { return null; }	// overrides and is covariant with Foo.test()
     }
     
    @@ -251,113 +221,113 @@ A functions in a derived class with the same name and parameter types as a function in a base class overrides that function: -
    class A
    +
    class A
     {
    -    int foo(int x) { ... }
    +    int foo(int x) { ... }
     }
     
    -class B : A
    +class B : A
     {
    -    override int foo(int x) { ... }
    +    override int foo(int x) { ... }
     }
     
    -void test()
    +void test()
     {
    -    B b = new B();
    +    B b = new B();
         bar(b);
     }
     
    -void bar(A a)
    +void bar(A a)
     {
    -    a.foo();	// calls B.foo(int)
    +    a.foo();	// calls B.foo(int)
     }
     
    However, when doing overload resolution, the functions in the base class are not considered: -
    class A
    +
    class A
     {
    -    int foo(int x) { ... }
    -    int foo(long y) { ... }
    +    int foo(int x) { ... }
    +    int foo(long y) { ... }
     }
     
    -class B : A
    +class B : A
     {
    -    override int foo(long x) { ... }
    +    override int foo(long x) { ... }
     }
     
    -void test()
    +void test()
     {
    -    B b = new B();
    +    B b = new B();
         bar(b);
     }
     
    -void bar(A a)
    +void bar(A a)
     {
    -    a.foo(1);		// calls A.foo(int)
    -    B b = new B();
    -    b.foo(1);		// calls B.foo(long), since A.foo(int) not considered
    +    a.foo(1);		// calls A.foo(int)
    +    B b = new B();
    +    b.foo(1);		// calls B.foo(long), since A.foo(int) not considered
     }
     
    To consider the base class's functions in the overload resolution process, use an AliasDeclaration: -
    class A
    +
    class A
     {
    -    int foo(int x) { ... }
    -    int foo(long y) { ... }
    +    int foo(int x) { ... }
    +    int foo(long y) { ... }
     }
     
    -class B : A
    +class B : A
     {
    -    alias A.foo foo;
    -    override int foo(long x) { ... }
    +    alias A.foo foo;
    +    override int foo(long x) { ... }
     }
     
    -void test()
    +void test()
     {
    -    B b = new B();
    +    B b = new B();
         bar(b);
     }
     
    -void bar(A a)
    +void bar(A a)
     {
    -    a.foo(1);		// calls A.foo(int)
    -    B b = new B();
    -    b.foo(1);		// calls A.foo(int)
    +    a.foo(1);		// calls A.foo(int)
    +    B b = new B();
    +    b.foo(1);		// calls A.foo(int)
     }
     
    A function parameter's default value is not inherited: -
    class A
    +
    class A
     {
    -    void foo(int x = 5) { ... }
    +    void foo(int x = 5) { ... }
     }
     
    -class B : A
    +class B : A
     {
    -    void foo(int x = 7) { ... }
    +    void foo(int x = 7) { ... }
     }
     
    -class C : B
    +class C : B
     {
    -    void foo(int x) { ... }
    +    void foo(int x) { ... }
     }
     
     
    -void test()
    +void test()
     {
    -    A a = new A();
    -    a.foo();		// calls A.foo(5)
    +    A a = new A();
    +    a.foo();		// calls A.foo(5)
     
    -    B b = new B();
    -    b.foo();		// calls B.foo(7)
    +    B b = new B();
    +    b.foo();		// calls B.foo(7)
     
    -    C c = new C();
    -    c.foo();		// error, need an argument for C.foo
    +    C c = new C();
    +    c.foo();		// error, need an argument for C.foo
     }
     
    @@ -396,7 +366,7 @@ in is the default; out and inout work like storage classes. For example: -
    int foo(int x, out int y, inout int z, int q);
    +
    int foo(int x, out int y, inout int z, int q);
     
    x is in, y is out, z is inout, and q is in. @@ -421,13 +391,13 @@ out parameters are set to the default initializer for the type of it. For example: -
    void foo(out int bar)
    +
    void foo(out int bar)
     {
     }
     
    -int bar = 3;
    +int bar = 3;
     foo(bar);
    -// bar is now 0
    +// bar is now 0
     
    @@ -450,16 +420,16 @@ a parameter of ... after the required function parameters. It has non-D linkage, such as extern (C): -
    extern (C) int foo(int x, int y, ...);
    +
    extern (C) int foo(int x, int y, ...);
     
    -foo(3, 4);	// ok
    -foo(3, 4, 6.8);	// ok, one variadic argument
    -foo(2);		// error, y is a required argument
    +foo(3, 4);	// ok
    +foo(3, 4, 6.8);	// ok, one variadic argument
    +foo(2);		// error, y is a required argument
     
    There must have at least one non-variadic parameter declared. -
    extern (C) int def(...); // error, must have at least one parameter
    +
    extern (C) int def(...); // error, must have at least one parameter
     
    This kind of function matches the C calling convention for @@ -473,12 +443,12 @@ arguments. To access the arguments, _argptr must be cast to a pointer to the expected argument type: -
    foo(3, 4, 5);	// first variadic argument is 5
    +
    foo(3, 4, 5);	// first variadic argument is 5
     
    -int foo(int x, int y, ...)
    -{   int z;
    +int foo(int x, int y, ...)
    +{   int z;
     
    -    z = *cast(int*)_argptr;	// z is set to 5
    +    z = *cast(int*)_argptr;	// z is set to 5
     }
     
    @@ -486,7 +456,7 @@ CPU architectures, use std.c.stdarg to access the variadic arguments: -
    import std.c.stdarg;
    +
    import std.c.stdarg;
     

    Variadic Functions With Type Info

    @@ -496,8 +466,8 @@ It has D linkage, and need not have any non-variadic parameters declared: -
    int abc(char c, ...);	// one required parameter: c
    -int def(...);		// ok
    +
    int abc(char c, ...);	// one required parameter: c
    +int def(...);		// ok
     
    These variadic functions have a special local variable declared for @@ -507,12 +477,12 @@ arguments. To access the arguments, _argptr must be cast to a pointer to the expected argument type: -
    foo(3, 4, 5);	// first variadic argument is 5
    +
    foo(3, 4, 5);	// first variadic argument is 5
     
    -int foo(int x, int y, ...)
    -{   int z;
    +int foo(int x, int y, ...)
    +{   int z;
     
    -    z = *cast(int*)_argptr;	// z is set to 5
    +    z = *cast(int*)_argptr;	// z is set to 5
     }
     
    @@ -522,48 +492,48 @@ _arguments gives the number of arguments and the type of each, enabling the creation of typesafe variadic functions. -
    class FOO { }
    +
    class FOO { }
     
    -void foo(int x, ...)
    +void foo(int x, ...)
     {
    -    printf("%d arguments\n", _arguments.length);
    -    for (int i = 0; i < _arguments.length; i++)
    +    printf("%d arguments\n", _arguments.length);
    +    for (int i = 0; i < _arguments.length; i++)
         {   _arguments[i].print();
     
    -	if (_arguments[i] == typeid(int))
    +	if (_arguments[i] == typeid(int))
     	{
    -	    int j = *cast(int *)_argptr;
    -	    _argptr += int.sizeof;
    -	    printf("\t%d\n", j);
    +	    int j = *cast(int *)_argptr;
    +	    _argptr += int.sizeof;
    +	    printf("\t%d\n", j);
     	}
    -	else if (_arguments[i] == typeid(long))
    +	else if (_arguments[i] == typeid(long))
     	{
    -	    long j = *cast(long *)_argptr;
    -	    _argptr += long.sizeof;
    -	    printf("\t%lld\n", j);
    +	    long j = *cast(long *)_argptr;
    +	    _argptr += long.sizeof;
    +	    printf("\t%lld\n", j);
     	}
    -	else if (_arguments[i] == typeid(double))
    +	else if (_arguments[i] == typeid(double))
     	{
    -	    double d = *cast(double *)_argptr;
    -	    _argptr += double.sizeof;
    -	    printf("\t%g\n", d);
    +	    double d = *cast(double *)_argptr;
    +	    _argptr += double.sizeof;
    +	    printf("\t%g\n", d);
     	}
    -	else if (_arguments[i] == typeid(FOO))
    +	else if (_arguments[i] == typeid(FOO))
     	{
    -	    FOO f = *cast(FOO*)_argptr;
    +	    FOO f = *cast(FOO*)_argptr;
     	    _argptr += FOO.sizeof;
    -	    printf("\t%p\n", f);
    +	    printf("\t%p\n", f);
     	}
    -	else
    -	    assert(0);
    +	else
    +	    assert(0);
         }
     }
     
    -void main()
    +void main()
     {
    -    FOO f = new FOO();
    +    FOO f = new FOO();
     
    -    printf("%p\n", f);
    +    printf("%p\n", f);
         foo(1, 2, 3L, 4.5, f);
     }
     
    @@ -572,11 +542,11 @@
    00870FD0
     4 arguments
    -int
    +int
     	2
    -long
    +long
     	3
    -double
    +double
     	4.5
     FOO
     	00870FD0
    @@ -586,36 +556,36 @@
     	CPU architectures, use std.stdarg to access the variadic
     	arguments:
     
    -
    import std.stdarg;
    +
    import std.stdarg;
     
    -void foo(int x, ...)
    +void foo(int x, ...)
     {
    -    printf("%d arguments\n", _arguments.length);
    -    for (int i = 0; i < _arguments.length; i++)
    +    printf("%d arguments\n", _arguments.length);
    +    for (int i = 0; i < _arguments.length; i++)
         {   _arguments[i].print();
     
    -	if (_arguments[i] == typeid(int))
    +	if (_arguments[i] == typeid(int))
     	{
    -	    int j = va_arg!(int)(_argptr);
    -	    printf("\t%d\n", j);
    +	    int j = va_arg!(int)(_argptr);
    +	    printf("\t%d\n", j);
     	}
    -	else if (_arguments[i] == typeid(long))
    +	else if (_arguments[i] == typeid(long))
     	{
    -	    long j = va_arg!(long)(_argptr);
    -	    printf("\t%lld\n", j);
    +	    long j = va_arg!(long)(_argptr);
    +	    printf("\t%lld\n", j);
     	}
    -	else if (_arguments[i] == typeid(double))
    +	else if (_arguments[i] == typeid(double))
     	{
    -	    double d = va_arg!(double)(_argptr);
    -	    printf("\t%g\n", d);
    +	    double d = va_arg!(double)(_argptr);
    +	    printf("\t%g\n", d);
     	}
    -	else if (_arguments[i] == typeid(FOO))
    +	else if (_arguments[i] == typeid(FOO))
     	{
     	    FOO f = va_arg!(FOO)(_argptr);
    -	    printf("\t%p\n", f);
    +	    printf("\t%p\n", f);
     	}
    -	else
    -	    assert(0);
    +	else
    +	    assert(0);
         }
     }
     
    @@ -629,63 +599,63 @@ For arrays: -
    int test()
    +
    int test()
     {
    -    return sum(1, 2, 3) + sum(); // returns 6+0
    +    return sum(1, 2, 3) + sum(); // returns 6+0
     }
     
    -int func()
    +int func()
     {
    -    static int[3] ii = [4, 5, 6];
    -    return sum(ii);		// returns 15
    +    static int[3] ii = [4, 5, 6];
    +    return sum(ii);		// returns 15
     }
     
    -int sum(int[] ar ...)
    +int sum(int[] ar ...)
     {
    -    int s;
    -    foreach (int x; ar)
    +    int s;
    +    foreach (int x; ar)
     	s += x;
    -    return s;
    +    return s;
     }
     
    For static arrays: -
    int test()
    +
    int test()
     {
    -    return sum(2, 3);	// error, need 3 values for array
    -    return sum(1, 2, 3); // returns 6
    +    return sum(2, 3);	// error, need 3 values for array
    +    return sum(1, 2, 3); // returns 6
     }
     
    -int func()
    +int func()
     {
    -    static int[3] ii = [4, 5, 6];
    -    int[] jj = ii;
    -    return sum(ii);		// returns 15
    -    return sum(jj);		// error, type mismatch
    +    static int[3] ii = [4, 5, 6];
    +    int[] jj = ii;
    +    return sum(ii);		// returns 15
    +    return sum(jj);		// error, type mismatch
     }
     
    -int sum(int[3] ar ...)
    +int sum(int[3] ar ...)
     {
    -    int s;
    -    foreach (int x; ar)
    +    int s;
    +    foreach (int x; ar)
     	s += x;
    -    return s;
    +    return s;
     }
     
    For class objects: -
    class Foo { int x; char[] s; }
    +
    class Foo { int x; char[] s; }
     
    -void test(int x, Foo f ...);
    +void test(int x, Foo f ...);
     
     ...
     
    -Foo g = new Foo(3, "abc");
    -test(1, g);		// ok, since g is an instance of Foo
    -test(1, 4, "def");	// ok
    -test(1, 5);		// error, no matching constructor for Foo
    +Foo g = new Foo(3, "abc");
    +test(1, g);		// ok, since g is an instance of Foo
    +test(1, 4, "def");	// ok
    +test(1, 5);		// error, no matching constructor for Foo
     
    An implementation may construct the object or array instance @@ -694,29 +664,29 @@
    Foo test(Foo f ...)
     {
    -    return f;	// error, f instance contents invalid after return
    +    return f;	// error, f instance contents invalid after return
     }
     
    -int[] test(int[] a ...)
    +int[] test(int[] a ...)
     {
    -    return a;		// error, array contents invalid after return
    -    return a[0..1];	// error, array contents invalid after return
    -    return a.dup;	// ok, since copy is made
    +    return a;		// error, array contents invalid after return
    +    return a[0..1];	// error, array contents invalid after return
    +    return a.dup;	// ok, since copy is made
     }
     
    For other types, the argument is built with itself, as in: -
    int test(int i ...)
    +
    int test(int i ...)
     {
    -    return i;
    +    return i;
     }
     
     ...
    -test(3);	// returns 3
    -test(3, 4);	// error, too many arguments
    -int[] x;
    -test(x);	// error, type mismatch
    +test(3);	// returns 3
    +test(3, 4);	// error, too many arguments
    +int[] x;
    +test(x);	// error, type mismatch
     

    Local Variables

    @@ -735,14 +705,14 @@ It is an error to declare a local variable that hides another local variable in the same function: -
    void func(int x)
    -{   int x;		error, hides previous definition of x
    -     double y;
    +
    void func(int x)
    +{   int x;		error, hides previous definition of x
    +     double y;
          ...
    -     {   char y;	error, hides previous definition of y
    -	  int z;
    +     {   char y;	error, hides previous definition of y
    +	  int z;
          }
    -     {   wchar z;	legal, previous z is out of scope
    +     {   wchar z;	legal, previous z is out of scope
          }
     }
     
    @@ -762,20 +732,20 @@ Functions may be nested within other functions: -
    int bar(int a)
    +
    int bar(int a)
     {
    -    int foo(int b)
    +    int foo(int b)
         {
    -	int abc() { return 1; }
    +	int abc() { return 1; }
     
    -	return b + abc();
    +	return b + abc();
         }
    -    return foo(a);
    +    return foo(a);
     }
     
    -void test()
    +void test()
     {
    -    int i = bar(3);	// i is assigned 4
    +    int i = bar(3);	// i is assigned 4
     }
     
    @@ -783,17 +753,17 @@ enclosing function, or by another nested function at the same nesting depth: -
    int bar(int a)
    +
    int bar(int a)
     {
    -    int foo(int b) { return b + 1; }
    -    int abc(int b) { return foo(b); }	// ok
    -    return foo(a);
    +    int foo(int b) { return b + 1; }
    +    int abc(int b) { return foo(b); }	// ok
    +    return foo(a);
     }
     
    -void test()
    +void test()
     {
    -    int i = bar(3);	// ok
    -    int j = bar.foo(3);	// error, bar.foo not visible
    +    int i = bar(3);	// ok
    +    int j = bar.foo(3);	// error, bar.foo not visible
     }
     
    @@ -801,40 +771,40 @@ defined by the lexically enclosing function. This access includes both the ability to read and write them. -
    int bar(int a)
    -{   int c = 3;
    +
    int bar(int a)
    +{   int c = 3;
     
    -    int foo(int b)
    +    int foo(int b)
         {
    -	b += c;		// 4 is added to b
    -	c++;		// bar.c is now 5
    -	return b + c;	// 12 is returned
    +	b += c;		// 4 is added to b
    +	c++;		// bar.c is now 5
    +	return b + c;	// 12 is returned
         }
         c = 4;
    -    int i = foo(a);	// i is set to 12
    -    return i + c;	// returns 17
    +    int i = foo(a);	// i is set to 12
    +    return i + c;	// returns 17
     }
     
    -void test()
    +void test()
     {
    -    int i = bar(3);	// i is assigned 17
    +    int i = bar(3);	// i is assigned 17
     }
     
    This access can span multiple nesting levels: -
    int bar(int a)
    -{   int c = 3;
    +
    int bar(int a)
    +{   int c = 3;
     
    -    int foo(int b)
    +    int foo(int b)
         {
    -	int abc()
    +	int abc()
     	{
    -	    return c;	// access bar.c
    +	    return c;	// access bar.c
     	}
    -	return b + c + abc();
    +	return b + c + abc();
         }
    -    return foo(3);
    +    return foo(3);
     }
     
    @@ -842,31 +812,31 @@ any lexically enclosing function, but can access static variables. This is analogous to how static member functions behave. -
    int bar(int a)
    -{   int c;
    -    static int d;
    +
    int bar(int a)
    +{   int c;
    +    static int d;
     
    -    static int foo(int b)
    +    static int foo(int b)
         {
    -	b = d;		// ok
    -	b = c;		// error, foo() cannot access frame of bar()
    -	return b + 1;
    +	b = d;		// ok
    +	b = c;		// error, foo() cannot access frame of bar()
    +	return b + 1;
         }
    -    return foo(a);
    +    return foo(a);
     }
     
    Functions can be nested within member functions: -
    struct Foo
    -{   int a;
    +
    struct Foo
    +{   int a;
     
    -    int bar()
    -    {   int c;
    +    int bar()
    +    {   int c;
     
    -	int foo()
    +	int foo()
     	{
    -	    return c + a;
    +	    return c + a;
     	}
         }
     }
    @@ -876,24 +846,24 @@
     	access to the stack variables of the enclosing function, but
     	do have access to the other symbols:
     
    -
    void test()
    -{   int j;
    -    static int s;
    -
    -    struct Foo
    -    {   int a;
    -
    -	int bar()
    -	{   int c = s;		// ok, s is static
    -	    int d = j;		// error, no access to frame of test()
    +
    void test()
    +{   int j;
    +    static int s;
    +
    +    struct Foo
    +    {   int a;
    +
    +	int bar()
    +	{   int c = s;		// ok, s is static
    +	    int d = j;		// error, no access to frame of test()
     
    -	    int foo()
    +	    int foo()
     	    {
    -		int e = s;	// ok, s is static
    -		int f = j;	// error, no access to frame of test()
    -		return c + a;	// ok, frame of bar() is accessible,
    -				// so are members of Foo accessible via
    -				// the 'this' pointer to Foo.bar()
    +		int e = s;	// ok, s is static
    +		int f = j;	// error, no access to frame of test()
    +		return c + a;	// ok, frame of bar() is accessible,
    +				// so are members of Foo accessible via
    +				// the 'this' pointer to Foo.bar()
     	    }
     	}
         }
    @@ -907,20 +877,20 @@
     	scope are processed in order. This means that two nested functions
     	cannot mutually call each other:
     
    -
    void test()
    +
    void test()
     {
    -    void foo() { bar(); }	// error, bar not defined
    -    void bar() { foo(); }	// ok
    +    void foo() { bar(); }	// error, bar not defined
    +    void bar() { foo(); }	// ok
     }
     
    The solution is to use a delegate: -
    void test()
    +
    void test()
     {
    -    void delegate() fp;
    -    void foo() { fp(); }
    -    void bar() { foo(); }
    +    void delegate() fp;
    +    void foo() { fp(); }
    +    void bar() { foo(); }
         fp = &bar;
     }
     
    @@ -932,32 +902,32 @@ A function pointer can point to a static nested function: -
    int function() fp;
    +
    int function() fp;
     
    -void test()
    -{   static int a = 7;
    -    static int foo() { return a + 3; }
    +void test()
    +{   static int a = 7;
    +    static int foo() { return a + 3; }
     
         fp = &foo;
     }
     
    -void bar()
    +void bar()
     {
         test();
    -    int i = fp();	// i is set to 10
    +    int i = fp();	// i is set to 10
     }
     
    A delegate can be set to a non-static nested function: -
    int delegate() dg;
    +
    int delegate() dg;
     
    -void test()
    -{   int a = 7;
    -    int foo() { return a + 3; }
    +void test()
    +{   int a = 7;
    +    int foo() { return a + 3; }
     
         dg = &foo;
    -    int i = dg();	// i is set to 10
    +    int i = dg();	// i is set to 10
     }
     
    @@ -965,11 +935,11 @@ declaring them has exited, in the same manner that pointers to stack variables are not valid upon exit from a function: -
    int* bar()
    -{   int b;
    +
    int* bar()
    +{   int b;
         test();
    -    int i = dg();	// error, test.a no longer exists
    -    return &b;		// error, bar.b not valid after bar() exits
    +    int i = dg();	// error, test.a no longer exists
    +    return &b;		// error, bar.b not valid after bar() exits
     }
     
    @@ -982,25 +952,25 @@ Both forms of delegates are interchangeable, and are actually the same type: -
    struct Foo
    -{   int a = 7;
    -    int bar() { return a; }
    +
    struct Foo
    +{   int a = 7;
    +    int bar() { return a; }
     }
     
    -int foo(int delegate() dg)
    +int foo(int delegate() dg)
     {
    -    return dg() + 1;
    +    return dg() + 1;
     }
     
    -void test()
    +void test()
     {
    -    int x = 27;
    -    int abc() { return x; }
    +    int x = 27;
    +    int abc() { return x; }
         Foo f;
    -    int i;
    +    int i;
     
    -    i = foo(&abc);	// i is set to 28
    -    i = foo(&f.bar);	// i is set to 8
    +    i = foo(&abc);	// i is set to 28
    +    i = foo(&f.bar);	// i is set to 8
     }
     
    @@ -1024,10 +994,10 @@ After it returns, all the module destructors are run. main() must be declared using one of the following forms: -
    void main() { ... }
    -void main(char[][] args) { ... }
    -int main() { ... }
    -int main(char[][] args) { ... }
    +
    void main() { ... }
    +void main(char[][] args) { ... }
    +int main() { ... }
    +int main(char[][] args) { ... }
     
    diff -uNr dmd-0.156/dmd/html/d/future.html dmd-0.157/dmd/html/d/future.html --- dmd-0.156/dmd/html/d/future.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/future.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -314,9 +283,9 @@
  • Do not store pointers into non-pointer variables using casts and other tricks. -
    void* p;
    +
    void* p;
     ...
    -int x = cast(int)p;   // error: undefined behavior
    +int x = cast(int)p;   // error: undefined behavior
     
    The garbage collector does not scan non-pointer types for roots. @@ -325,13 +294,13 @@
  • Do not take advantage of alignment of pointers to store bit flags in the low order bits: -
    p = cast(void*)(cast(int)p | 1);  // error: undefined behavior
    +
    p = cast(void*)(cast(int)p | 1);  // error: undefined behavior
     
  • Do not store into pointers values that may point into the garbage collected heap: -
    p = cast(void*)12345678;   // error: undefined behavior
    +
    p = cast(void*)12345678;   // error: undefined behavior
     
    A compacting garbage collector may change this value. @@ -352,7 +321,7 @@
  • Do not depend on the ordering of pointers: -
    if (p1 < p2)		// error: undefined behavior
    +
    if (p1 < p2)		// error: undefined behavior
         ...
     
    since, again, the garbage collector can move objects around in @@ -363,18 +332,18 @@ points outside of the bounds of the garbage collected object originally allocated. -
    char* p = new char[10];
    -char* q = p + 6;	// ok
    -q = p + 11;		// error: undefined behavior
    -q = p - 1;		// error: undefined behavior
    +
    char* p = new char[10];
    +char* q = p + 6;	// ok
    +q = p + 11;		// error: undefined behavior
    +q = p - 1;		// error: undefined behavior
     
  • Do not misaligned pointers if those pointers may point into the gc heap, such as: -
    align (1) struct Foo
    -{   byte b;
    -    char* p;	// misaligned pointer
    +
    align (1) struct Foo
    +{   byte b;
    +    char* p;	// misaligned pointer
     }
     
    @@ -401,7 +370,7 @@
  • Use a union to share storage with a pointer: -
    union U { void* ptr; int value }
    +
    union U { void* ptr; int value }
     
    Using such a union, however, as a substitute for a cast(int) will @@ -411,10 +380,10 @@
  • A pointer to the start of a garbage collected object need not be maintained if a pointer to the interior of the object exists. -
    char[] p = new char[10];
    -char[] q = p[3..6];
    -// q is enough to hold on to the object, don't need to keep
    -// p as well.
    +
    char[] p = new char[10];
    +char[] q = p[3..6];
    +// q is enough to hold on to the object, don't need to keep
    +// p as well.
     
    diff -uNr dmd-0.156/dmd/html/d/glossary.html dmd-0.157/dmd/html/d/glossary.html --- dmd-0.156/dmd/html/d/glossary.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/glossary.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
  • diff -uNr dmd-0.156/dmd/html/d/htomodule.html dmd-0.157/dmd/html/d/htomodule.html --- dmd-0.156/dmd/html/d/htomodule.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/htomodule.html 2006-05-08 15:25:44.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -56,131 +56,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    - +
    Mapping C type to D type
    Mapping C type to D type
    C type D type @@ -307,7 +269,7 @@ with: -
    cast(wchar[])"string"
    +
    cast(wchar[])"string"
     

    Macros

    @@ -322,7 +284,7 @@ can be replaced with: -
    enum
    +
    enum
     {   FOO = 1,
         BAR = 2,
         ABC = 3,
    @@ -332,10 +294,10 @@
     
     	or with:
     
    -
    const int FOO = 1;
    -const int BAR = 2;
    -const int ABC = 3;
    -const int DEF = 40;
    +
    const int FOO = 1;
    +const int BAR = 2;
    +const int ABC = 3;
    +const int DEF = 40;
     
    Function style macros, such as: @@ -345,7 +307,7 @@ can be replaced with functions: -
    int MAX(int a, int b) { return (a < b) ? b : a; }
    +
    int MAX(int a, int b) { return (a < b) ? b : a; }
     
    @@ -370,21 +332,21 @@ The corresponding D version would be: -
    const uint GT_DEPTH_SHIFT  = 0;
    -const uint GT_SIZE_SHIFT   = 8;
    -const uint GT_SCHEME_SHIFT = 24;
    -const uint GT_DEPTH_MASK   = 0xffU << GT_DEPTH_SHIFT;
    -const uint GT_TEXT         = 0x01 << GT_SCHEME_SHIFT;
    +
    const uint GT_DEPTH_SHIFT  = 0;
    +const uint GT_SIZE_SHIFT   = 8;
    +const uint GT_SCHEME_SHIFT = 24;
    +const uint GT_DEPTH_MASK   = 0xffU << GT_DEPTH_SHIFT;
    +const uint GT_TEXT         = 0x01 << GT_SCHEME_SHIFT;
     
    -// Template that constructs a graphtype
    -template GT_CONSTRUCT(uint depth, uint scheme, uint size)
    +// Template that constructs a graphtype
    +template GT_CONSTRUCT(uint depth, uint scheme, uint size)
     {
    - // notice the name of the const is the same as that of the template
    - const uint GT_CONSTRUCT = (depth | scheme | (size << GT_SIZE_SHIFT));
    + // notice the name of the const is the same as that of the template
    + const uint GT_CONSTRUCT = (depth | scheme | (size << GT_SIZE_SHIFT));
     }
     
    -// Common graphtypes
    -const uint GT_TEXT16 = GT_CONSTRUCT!(4, GT_TEXT, 16);
    +// Common graphtypes
    +const uint GT_TEXT16 = GT_CONSTRUCT!(4, GT_TEXT, 16);
     
    @@ -398,9 +360,9 @@ should be written as: -
    int* p, s;
    -int q;
    -int[3] t;
    +
    int* p, s;
    +int q;
    +int[3] t;
     

    Void Parameter Lists

    @@ -412,7 +374,7 @@ are in D: -
    int foo();
    +
    int foo();
     

    Const Type Modifiers

    @@ -425,7 +387,7 @@ becomes: -
    void foo(int* p, char* q);
    +
    void foo(int* p, char* q);
     

    Extern Global C Variables

    @@ -443,8 +405,8 @@ It can be replaced with two D modules, foo.d: -
    struct Foo { }
    -import fooextern;
    +
    struct Foo { }
    +import fooextern;
     
    and fooextern.d: @@ -466,7 +428,7 @@ becomes: -
    alias int foo;
    +
    alias int foo;
     

    Structs

    @@ -481,11 +443,11 @@ with: -
    struct Foo
    -{   int a;
    -    int b;
    +
    struct Foo
    +{   int a;
    +    int b;
     }
    -alias Foo* pFoo, lpFoo;
    +alias Foo* pFoo, lpFoo;
     

    Struct Member Alignment

    @@ -506,11 +468,11 @@ becomes: -
    struct Foo
    +
    struct Foo
     {
    -  align (1):
    -    int a;
    -    int b;
    +  align (1):
    +    int a;
    +    int b;
     }
     
    @@ -537,22 +499,22 @@ becomes: -
    struct Foo
    +
    struct Foo
     {
    -    int a;
    -    struct Bar
    +    int a;
    +    struct Bar
         {
    -	int c;
    +	int c;
         }
         Bar bar;
     };
     
    -struct Abc
    +struct Abc
     {
    -    int a;
    -    struct
    +    int a;
    +    struct
         {
    -	int c;
    +	int c;
         }
     };
     
    @@ -567,10 +529,10 @@ becomes: -
    extern (C) int x;
    -extern (C) int foo(int a);
    -extern (Pascal) int bar(int b);
    -extern (Windows) int abc(int c);
    +
    extern (C) int x;
    +extern (C) int foo(int a);
    +extern (Pascal) int bar(int b);
    +extern (Windows) int abc(int c);
     

    __declspec(dllimport)

    @@ -580,7 +542,7 @@ becomes: -
    export extern (Windows) int foo(int a);
    +
    export extern (Windows) int foo(int a);
     

    __fastcall

    diff -uNr dmd-0.156/dmd/html/d/iasm.html dmd-0.157/dmd/html/d/iasm.html --- dmd-0.156/dmd/html/d/iasm.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/iasm.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -198,13 +167,13 @@ They can be the target of goto statements. For example: -
    void *pc;
    -asm
    +
    void *pc;
    +asm
     {
         call L1		;
      L1:			;
         pop	EBX		;
    -    mov	pc[EBP],EBX	;	// pc now points to code at L1
    +    mov	pc[EBP],EBX	;	// pc now points to code at L1
     }
     
    @@ -248,17 +217,17 @@ One character is used per operand. For example: -
    asm
    +
    asm
     {
    -    db 5,6,0x83;   // insert bytes 0x05, 0x06, and 0x83 into code
    -    ds 0x1234;     // insert bytes 0x34, 0x12
    -    di 0x1234;     // insert bytes 0x34, 0x12, 0x00, 0x00
    -    dl 0x1234;     // insert bytes 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    -    df 1.234;      // insert float 1.234
    -    dd 1.234;      // insert double 1.234
    -    de 1.234;      // insert real 1.234
    -    db "abc";      // insert bytes 0x61, 0x62, and 0x63
    -    ds "abc";      // insert bytes 0x61, 0x00, 0x62, 0x00, 0x63, 0x00
    +    db 5,6,0x83;   // insert bytes 0x05, 0x06, and 0x83 into code
    +    ds 0x1234;     // insert bytes 0x34, 0x12
    +    di 0x1234;     // insert bytes 0x34, 0x12, 0x00, 0x00
    +    dl 0x1234;     // insert bytes 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    +    df 1.234;      // insert float 1.234
    +    dd 1.234;      // insert double 1.234
    +    de 1.234;      // insert real 1.234
    +    db "abc";      // insert bytes 0x61, 0x62, and 0x63
    +    ds "abc";      // insert bytes 0x61, 0x00, 0x62, 0x00, 0x63, 0x00
     }
     
    @@ -302,7 +271,7 @@ as the instructions they prefix; they appear in their own statement. For example: -
    asm
    +
    asm
     {
         rep   ;
         movsb ;
    @@ -323,10 +292,10 @@
     	
    floating point ops
    Use the two operand form of the instruction format; -
    fdiv ST(1);	// wrong
    -fmul ST;        // wrong
    -fdiv ST,ST(1);	// right
    -fmul ST,ST(0);	// right
    +
    fdiv ST(1);	// wrong
    +fmul ST;        // wrong
    +fdiv ST,ST(1);	// right
    +fmul ST,ST(0);	// right
     
    @@ -446,8 +415,8 @@ it can be disambiguated by using an AsmTypePrefix: -
    add	byte ptr [EAX],3	;
    -add	int ptr [EAX],7		;
    +
    add	byte ptr [EAX],3	;
    +add	int ptr [EAX],7		;
     

    Struct/Union/Class Member Offsets

    @@ -455,10 +424,10 @@ To access members of an aggregate, given a pointer to the aggregate is in a register, use the qualified name of the member: -
    struct Foo { int a,b,c; }
    -int bar(Foo *f)
    +
    struct Foo { int a,b,c; }
    +int bar(Foo *f)
     {
    -    asm
    +    asm
         {	mov	EBX,f		;
     	mov	EAX,Foo.b[EBX]	;
         }
    @@ -488,8 +457,7 @@
     
     

    Opcodes Supported

    - - +
    @@ -1148,8 +1116,7 @@

    Pentium 4 (Prescott) Opcodes Supported

    -
    aaa aad aam
    - +
    @@ -1173,8 +1140,7 @@

    AMD Opcodes Supported

    -
    addsubpd addsubps fisttp
    - +
    diff -uNr dmd-0.156/dmd/html/d/index.html dmd-0.157/dmd/html/d/index.html --- dmd-0.156/dmd/html/d/index.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/index.html 2006-05-10 11:39:34.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Wed May 10 11:39:33 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -189,71 +152,165 @@

    D Programming Language

    -
    "It seems to me that most of the "new" programming languages +
    "It seems to me that most of the "new" programming languages fall into one of two categories: Those from academia with radical new paradigms and those from large corporations with a focus on RAD and the web. Maybe it's time for a new language born out of - practical experience implementing compilers." -- Michael
    - -
    -

    "Great, just what I need.. another D in programming." -- Segfault

    + practical experience implementing compilers." -- Michael
    -

    This is the reference document for the D programming language. -D was conceived in December 1999 by Walter Bright as a reengineering of C and C++, -and has grown and evolved with helpful -suggestions and critiques by friends and colleagues. -

    - -

    Check out the quick comparison -of D with C, C++, C# and Java.

    -

    The D newsgroup in -news.digitalmars.com -server is where discussions -of this should go. Suggestions, criticism, kudos, flames, etc., -are all welcome there. -Alternatively, try the -D forum. -There also may be a local D user group -in your community (or you can start one!).

    - - -

    Download the current version -of the compiler for Win32 and x86 Linux and try it out.

    +
    "Great, just what I need.. another D in programming." -- Segfault +
    -

    David Friedman has integrated the -D frontend with GCC.

    -

    Gnu D for Mac OS X.

    +

    D is a systems programming language. +Its focus is on combining the power and high performance of C and C++ with +the programmer productivity of modern languages like Ruby and Python. +Special attention is given to the needs of quality assurance, documentation, +management, portability and reliability. +

    -

    Alternate versions of this document:

    +

    D is statically typed, and compiles direct to native code. +It's multiparadigm: supporting imperative, object oriented, and template +metaprogramming styles. +It's a member of the C syntax family, and its look and feel is +very close to C++'s. +For a quick feature comparison, see +this comparison +of D with C, C++, C# and Java.

    - +

    A large and growing collection of D source code and projects +are at dsource. +More links to innumerable D wikis, libraries, tools, media articles, +etc. are at dlinks. +

    -

    "D Language Perfect Guide"

    +

    This document is available as a +pdf, +as well as in +Japanese +and +Portugese +translations. +A Japanese book +D Language Perfect Guide +is available. +

    -

    The D open source community is at dsource.

    -

    Walter's SDWest 2006 - -presentation on D templates.

    -

    Walter's SDWest 2004 - -presentation on D.

    +

    This is an example D program illustrating some of the capabilities:

    +
    #!/usr/bin/dmd -run
    +/* sh style script syntax is supported */
    +
    +/* Hello World in D
    +   To compile:
    +     dmd hello.d
    +   or to optimize:
    +     dmd -O -inline -release hello.d
    +*/
    +
    +import std.stdio;
    +
    +void main(char[][] args)
    +{
    +    writefln("Hello World, Reloaded");
    +
    +    // auto type inference and built-in foreach
    +    foreach (argc, argv; args)
    +    {
    +        // Object Oriented Programming
    +        CmdLin cl = new CmdLin(argc, argv);
    +        // Improved typesafe printf
    +        writefln(cl.argnum, cl.suffix, " arg: %s", cl.argv);
    +        // Automatic or explicit memory management
    +        delete cl;
    +    }
    +
    +    // Nested structs and classes
    +    struct specs
    +    {
    +        // all members automatically initialized
    +        int count, allocated;
    +    }
    +
    +    // Nested functions can refer to outer
    +    // variables like args
    +    specs argspecs()
    +    {
    +        specs* s = new specs;
    +        // no need for '->'
    +        s.count = args.length;		   // get length of array with .length
    +        s.allocated = typeof(args).sizeof; // built-in native type properties
    +        foreach (argv; args)
    +            s.allocated += argv.length * typeof(argv[0]).sizeof;
    +        return *s;
    +    }
    +
    +    // built-in string and common string operations
    +    writefln("argc = %d, " ~ "allocated = %d",
    +	argspecs().count, argspecs().allocated);
    +}
    +
    +class CmdLin
    +{
    +    private int _argc;
    +    private char[] _argv;
    +
    +public:
    +    this(int argc, char[] argv)	// constructor
    +    {
    +        _argc = argc;
    +        _argv = argv;
    +    }
    +
    +    int argnum()
    +    {
    +        return _argc + 1;
    +    }
    +
    +    char[] argv()
    +    {
    +        return _argv;
    +    }
    +
    +    char[] suffix()
    +    {
    +        char[] suffix = "th";
    +        switch (_argc)
    +        {
    +          case 0:
    +            suffix = "st";
    +            break;
    +          case 1:
    +            suffix = "nd";
    +            break;
    +          case 2:
    +            suffix = "rd";
    +            break;
    +          default:
    +	    break;
    +        }
    +        return suffix;
    +    }
    +}
    +
    -

    Do you feel the -need for speed?

    Note: all D users agree that by downloading and using D, or reading the D specs, diff -uNr dmd-0.156/dmd/html/d/interface.html dmd-0.157/dmd/html/d/interface.html --- dmd-0.156/dmd/html/d/interface.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/interface.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -

    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -189,71 +152,165 @@

    D Programming Language

    -
    "It seems to me that most of the "new" programming languages +
    "It seems to me that most of the "new" programming languages fall into one of two categories: Those from academia with radical new paradigms and those from large corporations with a focus on RAD and the web. Maybe it's time for a new language born out of - practical experience implementing compilers." -- Michael
    - -
    -

    "Great, just what I need.. another D in programming." -- Segfault

    + practical experience implementing compilers." -- Michael
    -

    This is the reference document for the D programming language. -D was conceived in December 1999 by Walter Bright as a reengineering of C and C++, -and has grown and evolved with helpful -suggestions and critiques by friends and colleagues. -

    - -

    Check out the quick comparison -of D with C, C++, C# and Java.

    -

    The D newsgroup in -news.digitalmars.com -server is where discussions -of this should go. Suggestions, criticism, kudos, flames, etc., -are all welcome there. -Alternatively, try the -D forum. -There also may be a local D user group -in your community (or you can start one!).

    - - -

    Download the current version -of the compiler for Win32 and x86 Linux and try it out.

    +
    "Great, just what I need.. another D in programming." -- Segfault +
    -

    David Friedman has integrated the -D frontend with GCC.

    -

    Gnu D for Mac OS X.

    +

    D is a systems programming language. +Its focus is on combining the power and high performance of C and C++ with +the programmer productivity of modern languages like Ruby and Python. +Special attention is given to the needs of quality assurance, documentation, +management, portability and reliability. +

    -

    Alternate versions of this document:

    +

    D is statically typed, and compiles direct to native code. +It's multiparadigm: supporting imperative, object oriented, and template +metaprogramming styles. +It's a member of the C syntax family, and its look and feel is +very close to C++'s. +For a quick feature comparison, see +this comparison +of D with C, C++, C# and Java.

    - +

    A large and growing collection of D source code and projects +are at dsource. +More links to innumerable D wikis, libraries, tools, media articles, +etc. are at dlinks. +

    -

    "D Language Perfect Guide"

    +

    This document is available as a +pdf, +as well as in +Japanese +and +Portugese +translations. +A Japanese book +D Language Perfect Guide +is available. +

    -

    The D open source community is at dsource.

    -

    Walter's SDWest 2006 - -presentation on D templates.

    -

    Walter's SDWest 2004 - -presentation on D.

    +

    This is an example D program illustrating some of the capabilities:

    +
    #!/usr/bin/dmd -run
    +/* sh style script syntax is supported */
    +
    +/* Hello World in D
    +   To compile:
    +     dmd hello.d
    +   or to optimize:
    +     dmd -O -inline -release hello.d
    +*/
    +
    +import std.stdio;
    +
    +void main(char[][] args)
    +{
    +    writefln("Hello World, Reloaded");
    +
    +    // auto type inference and built-in foreach
    +    foreach (argc, argv; args)
    +    {
    +        // Object Oriented Programming
    +        CmdLin cl = new CmdLin(argc, argv);
    +        // Improved typesafe printf
    +        writefln(cl.argnum, cl.suffix, " arg: %s", cl.argv);
    +        // Automatic or explicit memory management
    +        delete cl;
    +    }
    +
    +    // Nested structs and classes
    +    struct specs
    +    {
    +        // all members automatically initialized
    +        int count, allocated;
    +    }
    +
    +    // Nested functions can refer to outer
    +    // variables like args
    +    specs argspecs()
    +    {
    +        specs* s = new specs;
    +        // no need for '->'
    +        s.count = args.length;		   // get length of array with .length
    +        s.allocated = typeof(args).sizeof; // built-in native type properties
    +        foreach (argv; args)
    +            s.allocated += argv.length * typeof(argv[0]).sizeof;
    +        return *s;
    +    }
    +
    +    // built-in string and common string operations
    +    writefln("argc = %d, " ~ "allocated = %d",
    +	argspecs().count, argspecs().allocated);
    +}
    +
    +class CmdLin
    +{
    +    private int _argc;
    +    private char[] _argv;
    +
    +public:
    +    this(int argc, char[] argv)	// constructor
    +    {
    +        _argc = argc;
    +        _argv = argv;
    +    }
    +
    +    int argnum()
    +    {
    +        return _argc + 1;
    +    }
    +
    +    char[] argv()
    +    {
    +        return _argv;
    +    }
    +
    +    char[] suffix()
    +    {
    +        char[] suffix = "th";
    +        switch (_argc)
    +        {
    +          case 0:
    +            suffix = "st";
    +            break;
    +          case 1:
    +            suffix = "nd";
    +            break;
    +          case 2:
    +            suffix = "rd";
    +            break;
    +          default:
    +	    break;
    +        }
    +        return suffix;
    +    }
    +}
    +
    -

    Do you feel the -need for speed?

    Note: all D users agree that by downloading and using D, or reading the D specs, diff -uNr dmd-0.156/dmd/html/d/lex.html dmd-0.157/dmd/html/d/lex.html --- dmd-0.156/dmd/html/d/lex.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/lex.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -

    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -208,10 +171,10 @@ Overloading operator/() also provides no symmetric way, as a member function, to overload the reverse operation. For example, -
    class A
    +
    class A
     {
    -    int operator/(int i);	// overloads (a+i)
    -    static operator/(int i, A a)	// overloads (i+a)
    +    int operator/(int i);	// overloads (a+i)
    +    static operator/(int i, A a)	// overloads (i+a)
     }
     
    @@ -229,17 +192,17 @@ when the operands are objects of different types: -
    class A { }
    -class B { }
    -int add(class A, class B);
    +
    class A { }
    +class B { }
    +int add(class A, class B);
     
    Should add() be in class A or B? The obvious stylistic solution would be to put it in the class of the first operand, -
    class A
    +
    class A
     {
    -    int add(class B) { }
    +    int add(class B) { }
     }
     
    @@ -345,40 +308,40 @@
  • 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: -
    static if (...) int x; else long x;
    +
    static if (...) int x; else long x;
     x = 3;
     
    whereas: -
    if (...) int x; else long x;
    -x = 3;    // error, x is not defined
    +
    if (...) int x; else long x;
    +x = 3;    // error, x is not defined
     
  • False static if conditionals don't have to semantically work. For example, it may depend on a conditionally compiled declaration somewhere else: -
    static if (...) int x;
    -int test()
    +
    static if (...) int x;
    +int test()
     {
    -    static if (...) return x;
    -    else return 0;
    +    static if (...) return x;
    +    else return 0;
     }
     
  • Static if's can appear where only declarations are allowed: -
    class Foo
    +
    class Foo
     {
    -	static if (...)
    -	    int x;
    +	static if (...)
    +	    int x;
     }
     
  • Static if's can declare new type aliases: -
    static if (0 || is(int T)) T x;
    +
    static if (0 || is(int T)) T x;
     
    diff -uNr dmd-0.156/dmd/html/d/rdmd.html dmd-0.157/dmd/html/d/rdmd.html --- dmd-0.156/dmd/html/d/rdmd.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/rdmd.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    diff -uNr dmd-0.156/dmd/html/d/statement.html dmd-0.157/dmd/html/d/statement.html --- dmd-0.156/dmd/html/d/statement.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/statement.html 2006-05-10 12:06:38.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Wed May 10 12:06:36 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
  • pavgusb pf2id pfacc @@ -176,12 +145,12 @@ Interfaces cannot derive from classes; only from other interfaces. Classes cannot derive from an interface multiple times. -
    interface D
    +
    interface D
     {
    -    void foo();
    +    void foo();
     }
     
    -class A : D, D	// error, duplicate interface
    +class A : D, D	// error, duplicate interface
     {
     }
     
    @@ -189,112 +158,112 @@ An instance of an interface cannot be created. -
    interface D
    +
    interface D
     {
    -    void foo();
    +    void foo();
     }
     
     ...
     
    -D d = new D();		// error, cannot create instance of interface
    +D d = new D();		// error, cannot create instance of interface
     
    Interface member functions do not have implementations. -
    interface D
    +
    interface D
     {
    -    void bar() { }	// error, implementation not allowed
    +    void bar() { }	// error, implementation not allowed
     }
     
    All interface functions must be defined in a class that inherits from that interface: -
    interface D
    +
    interface D
     {
    -    void foo();
    +    void foo();
     }
     
    -class A : D
    +class A : D
     {
    -    void foo() { }	// ok, provides implementation
    +    void foo() { }	// ok, provides implementation
     }
     
    -class B : D
    +class B : D
     {
    -    int foo() { }	// error, no void foo() implementation
    +    int foo() { }	// error, no void foo() implementation
     }
     
    Interfaces can be inherited and functions overridden: -
    interface D
    +
    interface D
     {
    -    int foo();
    +    int foo();
     }
     
    -class A : D
    +class A : D
     {
    -    int foo() { return 1; }
    +    int foo() { return 1; }
     }
     
    -class B : A
    +class B : A
     {
    -    int foo() { return 2; }
    +    int foo() { return 2; }
     }
     
     ...
     
    -B b = new B();
    -b.foo();		// returns 2
    -D d = cast(D) b;	// ok since B inherits A's D implementation
    -d.foo();		// returns 2;
    +B b = new B();
    +b.foo();		// returns 2
    +D d = cast(D) b;	// ok since B inherits A's D implementation
    +d.foo();		// returns 2;
     
    Interfaces can be reimplemented in derived classes: -
    interface D
    +
    interface D
     {
    -    int foo();
    +    int foo();
     }
     
    -class A : D
    +class A : D
     {
    -    int foo() { return 1; }
    +    int foo() { return 1; }
     }
     
    -class B : A, D
    +class B : A, D
     {
    -    int foo() { return 2; }
    +    int foo() { return 2; }
     }
     
     ...
     
    -B b = new B();
    -b.foo();		// returns 2
    -D d = cast(D) b;
    -d.foo();		// returns 2
    -A a = cast(A) b;
    -D d2 = cast(D) a;
    -d2.foo();		// returns 2, even though it is A's D, not B's D
    +B b = new B();
    +b.foo();		// returns 2
    +D d = cast(D) b;
    +d.foo();		// returns 2
    +A a = cast(A) b;
    +D d2 = cast(D) a;
    +d2.foo();		// returns 2, even though it is A's D, not B's D
     
    A reimplemented interface must implement all the interface functions, it does not inherit them from a super class: -
    interface D
    +
    interface D
     {
    -    int foo();
    +    int foo();
     }
     
    -class A : D
    +class A : D
     {
    -    int foo() { return 1; }
    +    int foo() { return 1; }
     }
     
    -class B : A, D
    +class B : A, D
     {
    -}		// error, no foo() for interface D
    +}		// error, no foo() for interface D
     

    COM Interfaces

    diff -uNr dmd-0.156/dmd/html/d/interfaceToC.html dmd-0.157/dmd/html/d/interfaceToC.html --- dmd-0.156/dmd/html/d/interfaceToC.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/interfaceToC.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -175,15 +144,15 @@ The C function must be declared and given a calling convention, most likely the "C" calling convention, for example: -
    extern (C) int strcmp(char* string1, char* string2);
    +
    extern (C) int strcmp(char* string1, char* string2);
     
    and then it can be called within D code in the obvious way: -
    import std.string;
    -int myDfunction(char[] s)
    +
    import std.string;
    +int myDfunction(char[] s)
     {
    -    return strcmp(std.string.toStringz(s), "foo");
    +    return strcmp(std.string.toStringz(s), "foo");
     }
     
    @@ -213,10 +182,10 @@ use an attribute that is compatible with the C compiler, most likely the extern (C): -
    // myfunc() can be called from any C function
    -extern (C)
    +
    // myfunc() can be called from any C function
    +extern (C)
     {
    -    void myfunc(int a, int b)
    +    void myfunc(int a, int b)
         {
     	...
         }
    @@ -461,9 +430,9 @@
     	dynamic arrays are a length followed by a pointer to the data,
     	the %.*s format works perfectly:
     
    -
    void foo(char[] string)
    +
    void foo(char[] string)
     {
    -    printf("my string is: %.*s\n", string);
    +    printf("my string is: %.*s\n", string);
     }
     
    diff -uNr dmd-0.156/dmd/html/d/intro.html dmd-0.157/dmd/html/d/intro.html --- dmd-0.156/dmd/html/d/intro.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/intro.html 2006-05-10 11:39:34.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Wed May 10 11:39:33 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -233,8 +202,7 @@ of the source text:

    - - +
    @@ -336,9 +304,9 @@ embedded strings and comments do not prevent recognition of comment openings and closings: -
    a = /+ // +/ 1;		// parses as if 'a = 1;'
    -a = /+ "+/" +/ 1";	// parses as if 'a = " +/ 1";'
    -a = /+ /* +/ */ 3;	// parses as if 'a = */ 3;'
    +
    a = /+ // +/ 1;		// parses as if 'a = 1;'
    +a = /+ "+/" +/ 1";	// parses as if 'a = " +/ 1";'
    +a = /+ /* +/ */ 3;	// parses as if 'a = */ 3;'
     
    Comments cannot be used as token concatenators, for example, @@ -519,9 +487,9 @@ regarded as a single \n character. There are no escape sequences inside r" ": -
    r"hello"
    -r"c:\root\foo.exe"
    -r"ab\n"			// string is 4 characters, 'a', 'b', '\', 'n'
    +
    r"hello"
    +r"c:\root\foo.exe"
    +r"ab\n"			// string is 4 characters, 'a', 'b', '\', 'n'
     
    An alternate form of wysiwyg strings are enclosed by backquotes, @@ -530,20 +498,20 @@ the regular ' character. Since, however, the ` is rarely used, it is useful to delineate strings with " in them. -
    `hello`
    -`c:\root\foo.exe`
    -`ab\n`			// string is 4 characters, 'a', 'b', '\', 'n'
    +
    `hello`
    +`c:\root\foo.exe`
    +`ab\n`			// string is 4 characters, 'a', 'b', '\', 'n'
     
    Double quoted strings are enclosed by "". Escape sequences can be embedded into them with the typical \ notation. EndOfLine is regarded as a single \n character. -
    "hello"
    -"c:\\root\\foo.exe"
    -"ab\n"			// string is 3 characters, 'a', 'b', and a linefeed
    -"ab
    -"			// string is 3 characters, 'a', 'b', and a linefeed
    +
    "hello"
    +"c:\\root\\foo.exe"
    +"ab\n"			// string is 3 characters, 'a', 'b', and a linefeed
    +"ab
    +"			// string is 3 characters, 'a', 'b', and a linefeed
     
    Escape strings start with a \ and form an escape character sequence. @@ -566,8 +534,8 @@ Hex strings allow string literals to be created using hex data: -
    x"0A"			// same as "\x0A"
    -x"00 FBCD 32FD 0A"	// same as "\x00\xFB\xCD\x32\xFD\x0A"
    +
    x"0A"			// same as "\x0A"
    +x"00 FBCD 32FD 0A"	// same as "\x00\xFB\xCD\x32\xFD\x0A"
     
    Whitespace and newlines are ignored, so the hex data can be @@ -578,17 +546,17 @@ Adjacent strings are concatenated with the ~ operator, or by simple juxtaposition: -
    "hello " ~ "world" ~ \n	// forms the string 'h','e','l','l','o',' ',
    -			// 'w','o','r','l','d',linefeed
    +
    "hello " ~ "world" ~ \n	// forms the string 'h','e','l','l','o',' ',
    +			// 'w','o','r','l','d',linefeed
     
    The following are all equivalent: -
    "ab" "c"
    -r"ab" r"c"
    -r"a" "bc"
    -"a" ~ "b" ~ "c"
    -\x61"bc"
    +
    "ab" "c"
    +r"ab" r"c"
    +r"a" "bc"
    +"a" ~ "b" ~ "c"
    +\x61"bc"
     
    The optional Postfix character gives a specific type @@ -598,8 +566,7 @@ to the postfix characters are:

    -

    Format BOM
    - +
    @@ -613,9 +580,9 @@
    Postfix Type
    dchar[ ]
    -

    "hello"c          // char[]
    -"hello"w          // wchar[]
    -"hello"d          // dchar[]
    +
    "hello"c          // char[]
    +"hello"w          // wchar[]
    +"hello"d          // dchar[]
     

    Character Literals

    @@ -755,8 +722,8 @@ The embedded '_' are useful for formatting long literals, such as using them as a thousands separator: -
    123_456		// 123456
    -1_2_3_4_5_6_	// 123456
    +
    123_456		// 123456
    +1_2_3_4_5_6_	// 123456
     
    Integers can be immediately followed by one 'L' or one 'u' or both. @@ -764,8 +731,7 @@ The type of the integer is resolved as follows:

    - - +
    @@ -911,9 +877,9 @@ make them more readable, such as using them as a thousands separator: -
    123_456.567_8		// 123456.5678
    -1_2_3_4_5_6_._5_6_7_8	// 123456.5678
    -1_2_3_4_5_6_._5e-6_	// 123456.5e-6
    +
    123_456.567_8		// 123456.5678
    +1_2_3_4_5_6_._5_6_7_8	// 123456.5678
    +1_2_3_4_5_6_._5e-6_	// 123456.5e-6
     
    Floating literals with no suffix are of type double. @@ -929,12 +895,12 @@ Examples: -
    0x1.FFFFFFFFFFFFFp1023		// double.max
    -0x1p-52				// double.epsilon
    -1.175494351e-38F		// float.min
    -6.3i				// idouble 6.3
    -6.3fi				// ifloat 6.3
    -6.3Li				// ireal 6.3
    +
    0x1.FFFFFFFFFFFFFp1023		// double.max
    +0x1p-52				// double.epsilon
    +1.175494351e-38F		// float.min
    +6.3i				// idouble 6.3
    +6.3fi				// ifloat 6.3
    +6.3Li				// ireal 6.3
     
    It is an error if the literal exceeds the range of the type. @@ -945,7 +911,7 @@ Complex literals are not tokens, but are assembled from real and imaginary expressions in the semantic analysis: -
    4.5 + 6.2i		// complex number
    +
    4.5 + 6.2i		// complex number
     

    Keywords

    @@ -1073,8 +1039,7 @@ table:

    -

    Decimal Literal Type
    - +
    @@ -1122,8 +1087,8 @@ For example: -
    int #line 6 "foo\bar"
    -x;			// this is now line 6 of file foo\bar
    +
    int #line 6 "foo\bar"
    +x;			// this is now line 6 of file foo\bar
     
    Note that the backslash character is not treated specially inside diff -uNr dmd-0.156/dmd/html/d/memory.html dmd-0.157/dmd/html/d/memory.html --- dmd-0.156/dmd/html/d/memory.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/memory.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -191,7 +154,7 @@

    What is D?

    - D is a general purpose systems and applications programming language. +

    D is a general purpose systems and applications programming language. It is a higher level language than C++, but retains the ability to write high performance code and interface directly with the operating system @@ -201,30 +164,29 @@ million line programs with teams of developers. D is easy to learn, provides many capabilities to aid the programmer, and is well suited to aggressive compiler optimization technology. -

    - D is not a scripting language, nor an interpreted language. It doesn't + D Man +

    + +

    D is not a scripting language, nor an interpreted language. It doesn't come with a VM, a religion, or an overriding philosophy. It's a practical language for practical programmers who need to get the job done quickly, reliably, and leave behind maintainable, easy to understand code. -

    - - D is the culmination of decades of experience implementing +

    +

    D is the culmination of decades of experience implementing compilers for many diverse languages, and attempting to construct large projects using those languages. D draws inspiration from those other languages (most especially C++) and tempers it with experience and real world practicality. - - D Man +

    Why D?

    - Why, indeed. Who needs another programming language? -

    - - The software industry has come a long way since the C language was +

    Why, indeed. Who needs another programming language? +

    +

    The software industry has come a long way since the C language was invented. Many new concepts were added to the language with C++, but backwards compatibility with C was maintained, including compatibility with @@ -239,24 +201,21 @@ C++ is a difficult and costly language to implement, resulting in implementation variations that make it frustrating to write fully portable C++ code. -

    - - C++ programmers tend to program in particular islands of the language, +

    +

    C++ programmers tend to program in particular islands of the language, i.e. getting very proficient using certain features while avoiding other feature sets. While the code is usually portable from compiler to compiler, it can be hard to port it from programmer to programmer. A great strength of C++ is that it can support many radically different styles of programming - but in long term use, the overlapping and contradictory styles are a hindrance. -

    - - C++ implements things like resizable arrays and string concatenation +

    +

    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 suboptimal consequences. -

    - - Can the power and capability of C++ be extracted, redesigned, +

    +

    Can the power and capability of C++ be extracted, redesigned, and recast into a language that is simple, orthogonal, and practical? Can it all be put into a package @@ -264,9 +223,8 @@ writers to correctly implement, and which enables compilers to efficiently generate aggressively optimized code? -

    - - Modern compiler technology has progressed to the point where language +

    +

    Modern compiler technology has progressed to the point where language features for the purpose of compensating for primitive compiler technology can be omitted. (An example of this would be the 'register' keyword in C, a more @@ -275,12 +233,11 @@ We can rely on modern compiler optimization technology to not need language features necessary to get acceptable code quality out of primitive compilers. -

    +

    Major Goals of D

    -
      -
    • Reduce software development costs by at least 10% by adding +
      • Reduce software development costs by at least 10% by adding in proven productivity enhancing features and by adjusting language features so that common, time-consuming bugs are eliminated from the start. @@ -316,13 +273,12 @@

        Features To Keep From C/C++

        - The general look of D is like C and C++. This makes it easier to learn +

        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 programmer will not have to learn an entirely new way of doing things. -

        - - Using D will not mean that the programmer will become restricted to a +

        +

        Using D will not mean that the programmer will become restricted to a specialized runtime vm (virtual machine) like the Java vm or the Smalltalk vm. There is no D vm, it's a straightforward compiler that generates @@ -330,9 +286,9 @@ D connects to the operating system just like C does. The usual familiar tools like make will fit right in with D development. +

        -
          -
        • The general look and feel of C/C++ is maintained. +
          • The general look and feel of C/C++ is maintained. It uses the same algebraic syntax, most of the same expression and statement forms, and the general layout. @@ -394,8 +350,7 @@

            Features To Drop

            -
              -
            • C source code compatibility. Extensions to C that maintain +
              • C source code compatibility. Extensions to C that maintain 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 @@ -485,8 +440,7 @@

                Who D is For

                -
                  -
                • Programmers who routinely use lint or similar code analysis tools +
                  • Programmers who routinely use lint or similar code analysis tools to eliminate bugs before the code is even compiled.
                  • People who compile with maximum warning levels turned on and who @@ -527,8 +481,7 @@

                    Who D is Not For

                    -
                      -
                    • Realistically, nobody is going to convert million line C or C++ +
                      • Realistically, nobody is going to convert million line C or C++ programs into D, and since D does not compile unmodified C/C++ source code, D is not for legacy apps. (However, D supports legacy C API's very well.) @@ -554,14 +507,15 @@

                        Major Features of D

                        - This section lists some of the more interesting features of D +

                        This section lists some of the more interesting features of D in various categories. +

                        Object Oriented Programming

                        Classes

                        - D's object oriented nature comes from classes. +

                        D's object oriented nature comes from classes. The inheritance model is single inheritance enhanced with interfaces. The class Object sits at the root of the inheritance hierarchy, so all classes implement @@ -569,57 +523,62 @@ Classes are instantiated by reference, and so complex code to clean up after exceptions is not required. +

                        Operator Overloading

                        - Classes can be crafted that work with existing operators to extend +

                        Classes can be crafted that work with existing operators to extend the type system to support new types. An example would be creating a bignumber class and then overloading the +, -, * and / operators to enable using ordinary algebraic syntax with them. +

                        Productivity

                        Modules

                        - Source files have a one-to-one correspondence with modules. +

                        Source files have a one-to-one correspondence with modules. 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 #ifndef/#endif or #pragma once kludges, etc. +

                        Declaration vs Definition

                        - C++ usually requires that functions and classes be declared twice - the declaration +

                        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 exactly how D works. -

                        +

                        +

                        Example: +

                        - Example: - -
                        class ABC
                        +
                        class ABC
                         {
                        -    int func() { return 7; }
                        -    static int z = 7;
                        +    int func() { return 7; }
                        +    static int z = 7;
                         }
                        -int q;
                        +int q;
                         
                        - There is no longer a need for a separate definition of member functions, static +

                        There is no longer a need for a separate definition of member functions, static members, externs, nor for clumsy syntaxes like: +

                        int ABC::func() { return 7; }
                         int ABC::z = 7;
                         extern int q;
                         
                        - Note: Of course, in C++, trivial functions like { return 7; } +

                        Note: Of course, in C++, trivial functions like { 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++: +

                        class Foo
                         {
                        @@ -633,54 +592,60 @@
                         };
                         
                        - But the equivalent D code will work: +

                        But the equivalent D code will work: +

                        -
                        class Foo
                        +
                        class Foo
                         {
                        -    int foo(Bar c) { return c.bar; }
                        +    int foo(Bar c) { return c.bar; }
                         }
                         
                        -class Bar
                        +class Bar
                         {
                        -    int bar() { return 3; }
                        +    int bar() { return 3; }
                         }
                         
                        - Whether a D function is inlined or not is determined by the +

                        Whether a D function is inlined or not is determined by the optimizer settings. +

                        Templates

                        - D templates offer a clean way to support generic programming while +

                        D templates offer a clean way to support generic programming while offering the power of partial specialization. +

                        Associative Arrays

                        - Associative arrays are arrays with an arbitrary data type as +

                        Associative arrays are arrays with an arbitrary data type as the index rather than being limited to an integer index. In essence, associated arrays are hash tables. Associative arrays make it easy to build fast, efficient, bug-free symbol tables. +

                        Real Typedefs

                        - C and C++ typedefs are really type aliases, as no new +

                        C and C++ typedefs are really type aliases, as no new type is really introduced. D implements real typedefs, where: +

                        -
                        typedef int handle;
                        +
                        typedef int handle;
                         
                        - really does create a new type handle. Type checking is +

                        really does create a new type handle. Type checking is enforced, and typedefs participate in function overloading. For example: +

                        -
                        int foo(int i);
                        -int foo(handle h);
                        +
                        int foo(int i);
                        +int foo(handle h);
                         

                        Documentation

                        - Documentation has traditionally been done twice - first there +

                        Documentation has traditionally been done twice - first there are comments documenting what a function does, and then this gets rewritten into a separate html or man page. And naturally, over time, they'll tend to diverge as the code @@ -691,12 +656,13 @@ to keep the documentation in sync with the code. Ddoc is the specification for the D documentation generator. This page was generated by Ddoc, too. -

                        +

                        - Although third party tools exist to do this for C++, they have some +

                        Although third party tools exist to do this for C++, they have some serious shortcomings: -

                          -
                        • It is spectacularly difficult to parse C++ 100% correctly. To +

                          + +
                          • It is spectacularly difficult to parse C++ 100% correctly. To do so really requires a full C++ compiler. Third party tools tend to parse only a subset of C++ correctly, so their use will constrain the source code to that subset. @@ -750,12 +716,11 @@ C arrays have several faults that can be corrected: -
                              -
                            • Dimension information is not carried around with +
                              • 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 main(int argc, char *argv[]). - (In D, main is declared as main(char[][] args).) + parameters to main(int argc, char *argv[]). + (In D, main is declared as main(char[][] args).)
                              • 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 @@ -776,8 +741,8 @@ In D, the [] for the array go on the left: -
                                int[3]* array;		// declares a pointer to an array of 3 ints
                                -long[] func(int x);	// declares a function returning an array of longs
                                +
                                int[3]* array;		// declares a pointer to an array of 3 ints
                                +long[] func(int x);	// declares a function returning an array of longs
                                 
                                which is much simpler to understand. @@ -933,7 +898,7 @@ and D provides primitives to build multithreaded programs with. Synchronization can be done at either the method or the object level. -
                                synchronized int func() { ... }
                                +
                                synchronized int func() { ... }
                                 
                                Synchronized functions allow only one thread at a time to be executing that @@ -945,56 +910,53 @@

                                Support for Robust Techniques

                                -
                                  -
                                • Dynamic arrays instead of pointers +
                                  • Dynamic arrays instead of pointers
                                  • -
                                  • Reference variables instead of pointers +
                                  • Reference variables instead of pointers
                                  • -
                                  • Reference objects instead of pointers +
                                  • Reference objects instead of pointers
                                  • -
                                  • Garbage collection instead of explicit memory management +
                                  • Garbage collection instead of explicit memory management
                                  • -
                                  • Built-in primitives for thread synchronization +
                                  • Built-in primitives for thread synchronization
                                  • -
                                  • No macros to inadvertently slam code +
                                  • No macros to inadvertently slam code
                                  • -
                                  • Inline functions instead of macros +
                                  • Inline functions instead of macros
                                  • -
                                  • Vastly reduced need for pointers +
                                  • Vastly reduced need for pointers
                                  • -
                                  • Integral type sizes are explicit +
                                  • Integral type sizes are explicit
                                  • -
                                  • No more uncertainty about the signed-ness of chars +
                                  • No more uncertainty about the signed-ness of chars
                                  • -
                                  • No need to duplicate declarations in source and header files. +
                                  • No need to duplicate declarations in source and header files.
                                  • -
                                  • Explicit parsing support for adding in debug code. +
                                  • Explicit parsing support for adding in debug code.

                                  Compile Time Checks

                                  -
                                    -
                                  • Stronger type checking +
                                    • Stronger type checking
                                    • -
                                    • No empty ; for loop bodies +
                                    • No empty ; for loop bodies
                                    • -
                                    • Assignments do not yield boolean results +
                                    • Assignments do not yield boolean results
                                    • -
                                    • Deprecating of obsolete API's +
                                    • Deprecating of obsolete API's

                                    Runtime Checking

                                    -
                                      -
                                    • assert() expressions +
                                      • assert() expressions
                                      • -
                                      • array bounds checking +
                                      • array bounds checking
                                      • -
                                      • undefined case in switch exception +
                                      • undefined case in switch exception
                                      • -
                                      • out of memory exception +
                                      • out of memory exception
                                      • -
                                      • In, out, and class invariant Contract Programming support +
                                      • In, out, and class invariant Contract Programming support
                                      @@ -1047,33 +1009,34 @@

                                      Deprecation

                                      - As code evolves over time, some old library code gets replaced +

                                      As code evolves over time, some old library code gets replaced with newer, better versions. The old versions must be available to support legacy code, but they can be marked as deprecated. Code that uses deprecated versions will be normally flagged as illegal, but would be allowed by a compiler switch. This will making it easy for maintenance programmers to identify any dependence on deprecated features. +


                                      Sample D Program (sieve.d)

                                      -
                                      /* Sieve of Eratosthenes prime numbers */
                                      +
                                      /* Sieve of Eratosthenes prime numbers */
                                        
                                      -bool[8191] flags;
                                      +bool[8191] flags;
                                        
                                      -int main()
                                      -{   int i, count, prime, k, iter;
                                      +int main()
                                      +{   int i, count, prime, k, iter;
                                       
                                      -    printf("10 iterations\n");
                                      -    for (iter = 1; iter <= 10; iter++)
                                      +    printf("10 iterations\n");
                                      +    for (iter = 1; iter <= 10; iter++)
                                           {	count = 0;
                                       	flags[] = 1;
                                      -	for (i = 0; i < flags.length; i++)
                                      -	{   if (flags[i])
                                      +	for (i = 0; i < flags.length; i++)
                                      +	{   if (flags[i])
                                       	    {	prime = i + i + 3;
                                       		k = i + prime;
                                      -		while (k < flags.length)
                                      +		while (k < flags.length)
                                       		{
                                       		    flags[k] = 0;
                                       		    k += prime;
                                      @@ -1082,8 +1045,8 @@
                                       	    }
                                       	}
                                           }
                                      -    printf ("\n%d primes", count);
                                      -    return 0;
                                      +    printf ("\n%d primes", count);
                                      +    return 0;
                                       }
                                       
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/object.html dmd-0.157/dmd/html/d/phobos/object.html --- dmd-0.156/dmd/html/d/phobos/object.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/object.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:34 2006 +
                                      Last update Wed May 10 12:07:46 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_base64.html dmd-0.157/dmd/html/d/phobos/std_base64.html --- dmd-0.156/dmd/html/d/phobos/std_base64.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_base64.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:34 2006 +
                                      Last update Wed May 10 12:07:46 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_bitarray.html dmd-0.157/dmd/html/d/phobos/std_bitarray.html --- dmd-0.156/dmd/html/d/phobos/std_bitarray.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_bitarray.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:47 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_boxer.html dmd-0.157/dmd/html/d/phobos/std_boxer.html --- dmd-0.156/dmd/html/d/phobos/std_boxer.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_boxer.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:48 2006
                                      @@ -118,11 +118,11 @@ the value afterwards.

                                      Example:
                                      -
                                      // Convert the integer 45 into a box.
                                      +
                                      // Convert the integer 45 into a box.
                                       Box b = box(45);
                                       
                                      -// Recover the integer and cast it to real.
                                      -real r = unbox!(real)(b);
                                      +// Recover the integer and cast it to real.
                                      +real r = unbox!(real)(b);
                                       
                                      That is the basic interface and will usually be all that you need to @@ -147,17 +147,17 @@

                                      Example:
                                      -
                                      // Convert arguments into an array of boxes.
                                      -Box[] a = boxArray(1, 45.4, "foobar");
                                      +
                                      // Convert arguments into an array of boxes.
                                      +Box[] a = boxArray(1, 45.4, "foobar");
                                       
                                      -// Convert an array of boxes back into arguments.
                                      +// Convert an array of boxes back into arguments.
                                       TypeInfo[] arg_types;
                                      -void* arg_data;
                                      +void* arg_data;
                                       
                                       boxArrayToArguments(a, arg_types, arg_data);
                                       
                                      -// Convert the arguments back into boxes using a
                                      -// different form of the function.
                                      +// Convert the arguments back into boxes using a
                                      +// different form of the function.
                                       a = boxArray(arg_types, arg_data);
                                       
                                      One use of this is to support a variadic function more easily and robustly; @@ -405,11 +405,11 @@

                                      Example:
                                       Box b = box(4.5);
                                      - bit u = unboxable!(real)(b); // This is true.
                                      - real r = unbox!(real)(b);
                                      + bit u = unboxable!(real)(b); // This is true.
                                      + real r = unbox!(real)(b);
                                       
                                        Box y = box(4);
                                      - int x = unbox!(int) (y);
                                      + int x = unbox!(int) (y);
                                       


                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_fenv.html dmd-0.157/dmd/html/d/phobos/std_c_fenv.html --- dmd-0.156/dmd/html/d/phobos/std_c_fenv.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_fenv.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:36 2006 +
                                      Last update Wed May 10 12:07:50 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_math.html dmd-0.157/dmd/html/d/phobos/std_c_math.html --- dmd-0.156/dmd/html/d/phobos/std_c_math.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_math.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:36 2006 +
                                      Last update Wed May 10 12:07:50 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_compiler.html dmd-0.157/dmd/html/d/phobos/std_compiler.html --- dmd-0.156/dmd/html/d/phobos/std_compiler.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_compiler.html 2006-05-10 12:07:48.000000000 +0200 @@ -28,7 +28,7 @@ Identify the compiler used and its various features." target="_top" title="Read/write comments and feedback">Comments -
                                      Last update Fri Apr 28 00:08:34 2006 +
                                      Last update Wed May 10 12:07:46 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_conv.html dmd-0.157/dmd/html/d/phobos/std_conv.html --- dmd-0.156/dmd/html/d/phobos/std_conv.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_conv.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:47 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_cover.html dmd-0.157/dmd/html/d/phobos/std_cover.html --- dmd-0.156/dmd/html/d/phobos/std_cover.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_cover.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:48 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_process.html dmd-0.157/dmd/html/d/phobos/std_c_process.html --- dmd-0.156/dmd/html/d/phobos/std_c_process.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_process.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:36 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_stdarg.html dmd-0.157/dmd/html/d/phobos/std_c_stdarg.html --- dmd-0.156/dmd/html/d/phobos/std_c_stdarg.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_stdarg.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:36 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_stddef.html dmd-0.157/dmd/html/d/phobos/std_c_stddef.html --- dmd-0.156/dmd/html/d/phobos/std_c_stddef.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_stddef.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:36 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_stdio.html dmd-0.157/dmd/html/d/phobos/std_c_stdio.html --- dmd-0.156/dmd/html/d/phobos/std_c_stdio.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_stdio.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:37 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_stdlib.html dmd-0.157/dmd/html/d/phobos/std_c_stdlib.html --- dmd-0.156/dmd/html/d/phobos/std_c_stdlib.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_stdlib.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:37 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_cstream.html dmd-0.157/dmd/html/d/phobos/std_cstream.html --- dmd-0.156/dmd/html/d/phobos/std_cstream.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_cstream.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:48 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_string.html dmd-0.157/dmd/html/d/phobos/std_c_string.html --- dmd-0.156/dmd/html/d/phobos/std_c_string.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_string.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:37 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_time.html dmd-0.157/dmd/html/d/phobos/std_c_time.html --- dmd-0.156/dmd/html/d/phobos/std_c_time.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_time.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:37 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_ctype.html dmd-0.157/dmd/html/d/phobos/std_ctype.html --- dmd-0.156/dmd/html/d/phobos/std_ctype.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_ctype.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:48 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_c_wcharh.html dmd-0.157/dmd/html/d/phobos/std_c_wcharh.html --- dmd-0.156/dmd/html/d/phobos/std_c_wcharh.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_c_wcharh.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:37 2006 +
                                      Last update Wed May 10 12:07:51 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_date.html dmd-0.157/dmd/html/d/phobos/std_date.html --- dmd-0.156/dmd/html/d/phobos/std_date.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_date.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:34 2006 +
                                      Last update Wed May 10 12:07:47 2006
                                      @@ -309,12 +309,12 @@

                                      Example:
                                        d_time lNow;
                                      -  char[] lNowString;
                                      +  char[] lNowString;
                                       
                                      -  // Grab the date and time relative to UTC
                                      +  // Grab the date and time relative to UTC
                                         lNow = std.date.getUTCtime();
                                      -  // Convert this into the local date and time for display.
                                      -  lNowString = std.date.toString(lNow);
                                      +  // Convert this into the local date and time for display.
                                      +  lNowString = std.date.toString(lNow);
                                       


                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_demangle.html dmd-0.157/dmd/html/d/phobos/std_demangle.html --- dmd-0.156/dmd/html/d/phobos/std_demangle.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_demangle.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:48 2006
                                      @@ -124,40 +124,40 @@ Example:
                                      This program reads standard in and writes it to standard out, pretty-printing any found D mangled names. -
                                      import std.stdio;
                                      -import std.ctype;
                                      -import std.demangle;
                                      -
                                      -int main()
                                      -{   char[] buffer;
                                      -    bool inword;
                                      -    int c;
                                      +
                                      import std.stdio;
                                      +import std.ctype;
                                      +import std.demangle;
                                      +
                                      +int main()
                                      +{   char[] buffer;
                                      +    bool inword;
                                      +    int c;
                                       
                                      -    while ((c = fgetc(stdin)) != EOF)
                                      +    while ((c = fgetc(stdin)) != EOF)
                                           {
                                      -	if (inword)
                                      +	if (inword)
                                       	{
                                      -	    if (c == '_' || isalnum(c))
                                      -		buffer ~= cast(char) c;
                                      -	    else
                                      +	    if (c == '_' || isalnum(c))
                                      +		buffer ~= cast(char) c;
                                      +	    else
                                       	    {
                                      -		inword = false;
                                      -		writef(demangle(buffer), cast(char) c);
                                      +		inword = false;
                                      +		writef(demangle(buffer), cast(char) c);
                                       	    }
                                       	}
                                      -	else
                                      -	{   if (c == '_' || isalpha(c))
                                      -	    {	inword = true;
                                      +	else
                                      +	{   if (c == '_' || isalpha(c))
                                      +	    {	inword = true;
                                       		buffer.length = 0;
                                      -		buffer ~= cast(char) c;
                                      +		buffer ~= cast(char) c;
                                       	    }
                                      -	    else
                                      -		writef(cast(char) c);
                                      +	    else
                                      +		writef(cast(char) c);
                                       	}
                                           }
                                      -    if (inword)
                                      -	writef(demangle(buffer));
                                      -    return 0;
                                      +    if (inword)
                                      +	writef(demangle(buffer));
                                      +    return 0;
                                       }
                                       
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_file.html dmd-0.157/dmd/html/d/phobos/std_file.html --- dmd-0.156/dmd/html/d/phobos/std_file.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_file.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:34 2006 +
                                      Last update Wed May 10 12:07:46 2006
                                      @@ -322,14 +322,14 @@ Example:
                                      This program lists all the files and subdirectories in its path argument. -
                                       import std.stdio;
                                      - import std.file;
                                      +
                                       import std.stdio;
                                      + import std.file;
                                       
                                      - void main(char[][] args)
                                      + void main(char[][] args)
                                        {
                                      -    char[][] dirs = std.file.listdir(args[1]);
                                      +    char[][] dirs = std.file.listdir(args[1]);
                                       
                                      -    foreach (char[] d; dirs)
                                      +    foreach (char[] d; dirs)
                                       	writefln(d);
                                        }
                                       
                                      @@ -356,28 +356,28 @@ Example:
                                      This program lists all the files with a "d" extension in the path passed as the first argument. -
                                       import std.stdio;
                                      - import std.file;
                                      +
                                       import std.stdio;
                                      + import std.file;
                                       
                                      - void main(char[][] args)
                                      + void main(char[][] args)
                                        {
                                      -    char[][] d_source_files = std.file.listdir(args[1], "*.d");
                                      +    char[][] d_source_files = std.file.listdir(args[1], "*.d");
                                       
                                      -    foreach (char[] d; d_source_files)
                                      +    foreach (char[] d; d_source_files)
                                       	writefln(d);
                                        }
                                       
                                      A regular expression version that searches for all files with "d" or "obj" extensions: -
                                       import std.stdio;
                                      - import std.file;
                                      - import std.regexp;
                                      +
                                       import std.stdio;
                                      + import std.file;
                                      + import std.regexp;
                                       
                                      - void main(char[][] args)
                                      + void main(char[][] args)
                                        {
                                      -    char[][] d_source_files = std.file.listdir(args[1], RegExp(r"\.(d|obj)$"));
                                      +    char[][] d_source_files = std.file.listdir(args[1], RegExp(r"\.(d|obj)$"));
                                       
                                      -    foreach (char[] d; d_source_files)
                                      +    foreach (char[] d; d_source_files)
                                       	writefln(d);
                                        }
                                       
                                      @@ -399,25 +399,28 @@ Example:
                                      This program lists all the files in its path argument, including the path. -
                                       import std.stdio;
                                      - import std.path;
                                      - import std.file;
                                      +
                                       import std.stdio;
                                      + import std.path;
                                      + import std.file;
                                       
                                      - void main(char[][] args)
                                      + void main(char[][] args)
                                        {
                                      -    char[] pathname = args[1];
                                      -    char[][] result;
                                      +    char[] pathname
                                      + = args[1];
                                      +    char[][] result;
                                       
                                      -    bool listing(char[] filename)
                                      +    bool listing(char[] filename)
                                           {
                                      -      result ~= std.path.join(pathname, filename);
                                      -      return true; // continue
                                      +      result ~= std.path.join(pathname
                                      +, filename);
                                      +      return true; // continue
                                           }
                                       
                                      -    listdir(pathname, &listing);
                                      +    listdir(pathname
                                      +, &listing);
                                       
                                      -    foreach (char[] name; result)
                                      -      writefln("%s", name);
                                      +    foreach (char[] name; result)
                                      +      writefln("%s", name);
                                        }
                                       
                                      @@ -438,21 +441,24 @@ Example:
                                      This program lists all the files in its path argument and all subdirectories thereof. -
                                       import std.stdio;
                                      - import std.file;
                                      +
                                       import std.stdio;
                                      + import std.file;
                                       
                                      - void main(char[][] args)
                                      + void main(char[][] args)
                                        {
                                      -    bool callback(DirEntry* de)
                                      +    bool callback
                                      +(DirEntry* de)
                                           {
                                      -      if (de.isdir)
                                      -        listdir(de.name, &callback);
                                      -      else
                                      +      if (de.isdir)
                                      +        listdir(de.name, &callback
                                      +);
                                      +      else
                                               writefln(de.name);
                                      -      return true;
                                      +      return true;
                                           }
                                       
                                      -    listdir(args[1], &callback);
                                      +    listdir(args[1], &callback
                                      +);
                                        }
                                       
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_format.html dmd-0.157/dmd/html/d/phobos/std_format.html --- dmd-0.156/dmd/html/d/phobos/std_format.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_format.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:34 2006 +
                                      Last update Wed May 10 12:07:46 2006
                                      @@ -387,24 +387,26 @@

                                      Example:
                                      -
                                      import std.c.stdio;
                                      -import std.format;
                                      +
                                      import std.c.stdio;
                                      +import std.format;
                                       
                                      -void formattedPrint(...)
                                      +void formattedPrint(...)
                                       {
                                      -    void putc(char c)
                                      +    void putc
                                      +(char c)
                                           {
                                       	fputc(c, stdout);
                                           }
                                       
                                      -    std.format.doFormat(&putc, _arguments, _argptr);
                                      +    std.format.doFormat(&putc
                                      +, _arguments, _argptr);
                                       }
                                       
                                       ...
                                       
                                      -int x = 27;
                                      -// prints 'The answer is 27:6'
                                      -formattedPrint("The answer is %s:", x, 6);
                                      +int x = 27;
                                      +// prints 'The answer is 27:6'
                                      +formattedPrint("The answer is %s:", x, 6);
                                       


                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_gc.html dmd-0.157/dmd/html/d/phobos/std_gc.html --- dmd-0.156/dmd/html/d/phobos/std_gc.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_gc.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:48 2006
                                      diff -uNr dmd-0.156/dmd/html/d/phobos/std_intrinsic.html dmd-0.157/dmd/html/d/phobos/std_intrinsic.html --- dmd-0.156/dmd/html/d/phobos/std_intrinsic.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_intrinsic.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
                                      Last update Fri Apr 28 00:08:35 2006 +
                                      Last update Wed May 10 12:07:48 2006
                                      @@ -146,19 +146,25 @@ The return value is undefined if v is zero.

                                      Example:
                                      -
                                       import std.intrinsic;
                                      +
                                       import std.intrinsic;
                                       
                                      - int main()
                                      + int main()
                                        {
                                      -     uint v;
                                      -     int x;
                                      -
                                      -     v = 0x21;
                                      -     x = bsf(v);
                                      -     printf("bsf(x%x) = %d\n", v, x);
                                      -     x = bsr(v);
                                      -     printf("bsr(x%x) = %d\n", v, x);
                                      -     return 0;
                                      +     uint v
                                      +;
                                      +     int x;
                                      +
                                      +     v
                                      + = 0x21;
                                      +     x = bsf(v
                                      +);
                                      +     printf("bsf(x%x) = %d\n", v
                                      +, x);
                                      +     x = bsr(v
                                      +);
                                      +     printf("bsr(x%x) = %d\n", v
                                      +, x);
                                      +     return 0;
                                        }
                                       


                                      @@ -200,7 +206,8 @@
    Special Token Replaced with...
    @@ -196,17 +165,17 @@ For example, a function to convert an array of characters to upper case: -
    char[] toupper(char[] s)
    +
    char[] toupper(char[] s)
     {
    -    int i;
    +    int i;
     
    -    for (i = 0; i < s.length; i++)
    +    for (i = 0; i < s.length; i++)
         {
    -	char c = s[i];
    -	if ('a' <= c && c <= 'z')
    -	    s[i] = c - (cast(char)'a' - 'A');
    +	char c = s[i];
    +	if ('a' <= c && c <= 'z')
    +	    s[i] = c - (cast(char)'a' - 'A');
         }
    -    return s;
    +    return s;
     }
     
    @@ -228,27 +197,27 @@ it'll have to be done explicitly in the code. Here's toupper() rewritten to implement copy-on-write in an efficient manner: -
    char[] toupper(char[] s)
    +
    char[] toupper(char[] s)
     {
    -    int changed;
    -    int i;
    +    int changed;
    +    int i;
     
         changed = 0;
    -    for (i = 0; i < s.length; i++)
    +    for (i = 0; i < s.length; i++)
         {
    -	char c = s[i];
    -	if ('a' <= c && c <= 'z')
    +	char c = s[i];
    +	if ('a' <= c && c <= 'z')
     	{
    -	    if (!changed)
    -	    {   char[] r = new char[s.length];
    +	    if (!changed)
    +	    {   char[] r = new char[s.length];
     		r[] = s;
     		s = r;
     		changed = 1;
     	    }
    -	    s[i] = c - (cast(char)'a' - 'A');
    +	    s[i] = c - (cast(char)'a' - 'A');
     	}
         }
    -    return s;
    +    return s;
     }
     
    @@ -299,33 +268,33 @@ deallocating an object when done with it, put it on a free list. When allocating, pull one off the free list first. -
    class Foo
    +
    class Foo
     {
    -    static Foo freelist;		// start of free list
    +    static Foo freelist;		// start of free list
     
    -    static Foo allocate()
    +    static Foo allocate()
         {   Foo f;
     
    -	if (freelist)
    +	if (freelist)
     	{   f = freelist;
     	    freelist = f.next;
     	}
    -	else
    -	    f = new Foo();
    -	return f;
    +	else
    +	    f = new Foo();
    +	return f;
         }
     
    -    static void deallocate(Foo f)
    +    static void deallocate(Foo f)
         {
     	f.next = freelist;
     	freelist = f;
         }
     
    -    Foo next;		// for use by FooFreeList
    +    Foo next;		// for use by FooFreeList
         ...
     }
     
    -void test()
    +void test()
     {
         Foo f = Foo.allocate();
         ...
    @@ -375,26 +344,26 @@
     	For example, to allocate using the C runtime library's
     	malloc and free:
     
    -
    import std.c.stdlib;
    -import std.outofmemory;
    -import std.gc;
    +
    import std.c.stdlib;
    +import std.outofmemory;
    +import std.gc;
     
    -class Foo
    +class Foo
     {
    -    new(size_t sz)
    +    new(size_t sz)
         {
    -	void* p;
    +	void* p;
     
     	p = std.c.stdlib.malloc(sz);
    -	if (!p)
    -	    throw new OutOfMemoryException();
    +	if (!p)
    +	    throw new OutOfMemoryException();
     	std.gc.addRange(p, p + sz);
    -	return p;
    +	return p;
         }
     
    -    delete(void* p)
    +    delete(void* p)
         {
    -	if (p)
    +	if (p)
     	{   gc.removeRange(p);
     	    std.c.stdlib.free(p);
     	}
    @@ -466,68 +435,68 @@
     	'marked', and then whole sections of memory are released
     	simply by resetting the stack pointer back to a marked point.
     
    -
    import std.c.stdlib;
    -import std.outofmemory;
    +
    import std.c.stdlib;
    +import std.outofmemory;
     
    -class Foo
    +class Foo
     {
    -    static void[] buffer;
    -    static int bufindex;
    -    static const int bufsize = 100;
    +    static void[] buffer;
    +    static int bufindex;
    +    static const int bufsize = 100;
     
    -    static this()
    -    {   void *p;
    +    static this()
    +    {   void *p;
     
     	p = malloc(bufsize);
    -	if (!p)
    -	    throw new OutOfMemory;
    +	if (!p)
    +	    throw new OutOfMemory;
     	gc.addRange(p, p + bufsize);
     	buffer = p[0 .. bufsize];
         }
     
    -    static ~this()
    +    static ~this()
         {
    -	if (buffer.length)
    +	if (buffer.length)
     	{
     	    gc.removeRange(buffer);
     	    free(buffer);
    -	    buffer = null;
    +	    buffer = null;
     	}
         }
     
    -    new(size_t sz)
    -    {   void *p;
    +    new(size_t sz)
    +    {   void *p;
     
     	p = &buffer[bufindex];
     	bufindex += sz;
    -	if (bufindex > buffer.length)
    -	    throw new OutOfMemory;
    -	return p;
    +	if (bufindex > buffer.length)
    +	    throw new OutOfMemory;
    +	return p;
         }
     
    -    delete(void* p)
    +    delete(void* p)
         {
    -	assert(0);
    +	assert(0);
         }
     
    -    static int mark()
    +    static int mark()
         {
    -	return bufindex;
    +	return bufindex;
         }
     
    -    static void release(int i)
    +    static void release(int i)
         {
     	bufindex = i;
         }
     }
     
    -void test()
    +void test()
     {
    -    int m = Foo.mark();
    -    Foo f1 = new Foo;		// allocate
    -    Foo f2 = new Foo;		// allocate
    +    int m = Foo.mark();
    +    Foo f1 = new Foo;		// allocate
    +    Foo f2 = new Foo;		// allocate
         ...
    -    Foo.release(m);		// deallocate f1 and f2
    +    Foo.release(m);		// deallocate f1 and f2
     }
     
    @@ -558,24 +527,24 @@ Although the current implementation does not put such objects on the stack, future ones can. -
    import std.c.stdlib;
    +
    import std.c.stdlib;
     
    -class Foo
    +class Foo
     {
    -    new(size_t sz, void *p)
    +    new(size_t sz, void *p)
         {
    -	return p;
    +	return p;
         }
     
    -    delete(void* p)
    +    delete(void* p)
         {
    -	assert(0);
    +	assert(0);
         }
     }
     
    -void test()
    +void test()
     {
    -    Foo f = new(std.c.stdlib.alloca(Foo.classinfo.init.length)) Foo;
    +    Foo f = new(std.c.stdlib.alloca(Foo.classinfo.init.length)) Foo;
         ...
     }
     
    @@ -596,8 +565,8 @@ Arrays are always initialized in D. So, the following declaration: -
    void foo()
    -{   byte[1024] buffer;
    +
    void foo()
    +{   byte[1024] buffer;
     
         fillBuffer(buffer);
         ...
    @@ -609,8 +578,8 @@
     	that this initialization is a speed problem, it can be eliminated using
     	a VoidInitializer:
     
    -
    void foo()
    -{   byte[1024] buffer = void;
    +
    void foo()
    +{   byte[1024] buffer = void;
     
         fillBuffer(buffer);
         ...
    diff -uNr dmd-0.156/dmd/html/d/mixin.html dmd-0.157/dmd/html/d/mixin.html
    --- dmd-0.156/dmd/html/d/mixin.html	2006-04-26 22:34:32.000000000 +0200
    +++ dmd-0.157/dmd/html/d/mixin.html	2006-05-08 15:25:44.000000000 +0200
    @@ -25,7 +25,7 @@
     	| Comments
     
    -	
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -186,105 +155,105 @@ templated nested functions, which is not possible with template instantiations. -
    template Foo()
    +
    template Foo()
     {
    -    int x = 5;
    +    int x = 5;
     }
     
    -mixin Foo;
    +mixin Foo;
     
    -struct Bar
    +struct Bar
     {
    -    mixin Foo;
    +    mixin Foo;
     }
     
    -void test()
    +void test()
     {
    -    printf("x = %d\n", x);		// prints 5
    +    printf("x = %d\n", x);		// prints 5
         {   Bar b;
    -	int x = 3;
    +	int x = 3;
     
    -	printf("b.x = %d\n", b.x);	// prints 5
    -	printf("x = %d\n", x);		// prints 3
    +	printf("b.x = %d\n", b.x);	// prints 5
    +	printf("x = %d\n", x);		// prints 3
     	{
    -	    mixin Foo;
    -	    printf("x = %d\n", x);	// prints 5
    +	    mixin Foo;
    +	    printf("x = %d\n", x);	// prints 5
     	    x = 4;
    -	    printf("x = %d\n", x);	// prints 4
    +	    printf("x = %d\n", x);	// prints 4
     	}
    -	printf("x = %d\n", x);		// prints 3
    +	printf("x = %d\n", x);		// prints 3
         }
    -    printf("x = %d\n", x);		// prints 5
    +    printf("x = %d\n", x);		// prints 5
     }
     
    Mixins can be parameterized: -
    template Foo(T)
    +
    template Foo(T)
     {
         T x = 5;
     }
     
    -mixin Foo!(int);		// create x of type int
    +mixin Foo!(int);		// create x of type int
     
    Mixins can add virtual functions to a class: -
    template Foo()
    +
    template Foo()
     {
    -    void func() { printf("Foo.func()\n"); }
    +    void func() { printf("Foo.func()\n"); }
     }
     
    -class Bar
    +class Bar
     {
    -    mixin Foo;
    +    mixin Foo;
     }
     
    -class Code : Bar
    +class Code : Bar
     {
    -    void func() { printf("Code.func()\n"); }
    +    void func() { printf("Code.func()\n"); }
     }
     
    -void test()
    +void test()
     {
    -    Bar b = new Bar();
    -    b.func();		// calls Foo.func()
    +    Bar b = new Bar();
    +    b.func();		// calls Foo.func()
     
    -    b = new Code();
    -    b.func();		// calls Code.func()
    +    b = new Code();
    +    b.func();		// calls Code.func()
     }
     
    Mixins are evaluted in the scope of where they appear, not the scope of the template declaration: -
    int y = 3;
    +
    int y = 3;
     
    -template Foo()
    +template Foo()
     {
    -    int abc() { return y; }
    +    int abc() { return y; }
     }
     
    -void test()
    +void test()
     {
    -    int y = 8;
    -    mixin Foo;	// local y is picked up, not global y
    -    assert(abc() == 8);
    +    int y = 8;
    +    mixin Foo;	// local y is picked up, not global y
    +    assert(abc() == 8);
     }
     
    Mixins can parameterize symbols using alias parameters: -
    template Foo(alias b)
    +
    template Foo(alias b)
     {
    -    int abc() { return b; }
    +    int abc() { return b; }
     }
     
    -void test()
    +void test()
     {
    -    int y = 8;
    -    mixin Foo!(y);
    -    assert(abc() == 8);
    +    int y = 8;
    +    mixin Foo!(y);
    +    assert(abc() == 8);
     }
     
    @@ -293,38 +262,38 @@ is in bold). A nested function is generated as well as a delegate literal, these can be inlined by the compiler: -
    template duffs_device(alias id1, alias id2, alias s)
    +
    template duffs_device(alias id1, alias id2, alias s)
     {
    -    void duff_loop()
    +    void duff_loop()
         {
    -	if (id1 < id2)
    +	if (id1 < id2)
     	{
    -	    typeof(id1) n = (id2 - id1 + 7) / 8;
    -	    switch ((id2 - id1) % 8)
    +	    typeof(id1) n = (id2 - id1 + 7) / 8;
    +	    switch ((id2 - id1) % 8)
     	    {
    -		case 0:        do {  s();
    -		case 7:              s();
    -		case 6:              s();
    -		case 5:              s();
    -		case 4:              s();
    -		case 3:              s();
    -		case 2:              s();
    -		case 1:              s();
    -				  } while (--n > 0);
    +		case 0:        do {  s();
    +		case 7:              s();
    +		case 6:              s();
    +		case 5:              s();
    +		case 4:              s();
    +		case 3:              s();
    +		case 2:              s();
    +		case 1:              s();
    +				  } while (--n > 0);
     	    }
     	}
         }
     }
     
    -void foo() { printf("foo\n"); }
    +void foo() { printf("foo\n"); }
     
    -void test()
    +void test()
     {
    -    int i = 1;
    -    int j = 11;
    +    int i = 1;
    +    int j = 11;
     
    -    mixin duffs_device!(i, j, delegate { foo(); } );
    -    duff_loop();	// executes foo() 10 times
    +    mixin duffs_device!(i, j, delegate { foo(); } );
    +    duff_loop();	// executes foo() 10 times
     }
     
    @@ -335,21 +304,21 @@ as a declaration in the surrounding scope, the surrounding declaration overrides the mixin one: -
    int x = 3;
    +
    int x = 3;
     
    -template Foo()
    +template Foo()
     {
    -    int x = 5;
    -    int y = 5;
    +    int x = 5;
    +    int y = 5;
     }
     
    -mixin Foo;
    -int y = 3;
    +mixin Foo;
    +int y = 3;
     
    -void test()
    +void test()
     {
    -    printf("x = %d\n", x);	// prints 3
    -    printf("y = %d\n", y);	// prints 3
    +    printf("x = %d\n", x);	// prints 3
    +    printf("y = %d\n", y);	// prints 3
     }
     
    @@ -357,70 +326,70 @@ define a declaration with the same name, there is an ambiguity error when the declaration is referenced: -
    template Foo()
    +
    template Foo()
     {
    -    int x = 5;
    +    int x = 5;
     }
     
    -template Bar()
    +template Bar()
     {
    -    int x = 4;
    +    int x = 4;
     }
     
    -mixin Foo;
    -mixin Bar;
    +mixin Foo;
    +mixin Bar;
     
    -void test()
    +void test()
     {
    -    printf("x = %d\n", x);	// error, x is ambiguous
    +    printf("x = %d\n", x);	// error, x is ambiguous
     }
     
    If a mixin has a MixinIdentifier, it can be used to disambiguate: -
    int x = 6;
    +
    int x = 6;
     
    -template Foo()
    +template Foo()
     {
    -    int x = 5;
    -    int y = 7;
    +    int x = 5;
    +    int y = 7;
     }
     
    -template Bar()
    +template Bar()
     {
    -    int x = 4;
    +    int x = 4;
     }
     
    -mixin Foo F;
    -mixin Bar B;
    +mixin Foo F;
    +mixin Bar B;
     
    -void test()
    +void test()
     {
    -    printf("y = %d\n", y);	// prints 7
    -    printf("x = %d\n", x);	// prints 6
    -    printf("F.x = %d\n", F.x);	// prints 5
    -    printf("B.x = %d\n", B.x);	// prints 4
    +    printf("y = %d\n", y);	// prints 7
    +    printf("x = %d\n", x);	// prints 6
    +    printf("F.x = %d\n", F.x);	// prints 5
    +    printf("B.x = %d\n", B.x);	// prints 4
     }
     
    A mixin has its own scope, even if a declaration is overridden by the enclosing one: -
    int x = 4;
    +
    int x = 4;
     
    -template Foo()
    +template Foo()
     {
    -    int x = 5;
    -    int bar() { return x; }
    +    int x = 5;
    +    int bar() { return x; }
     }
     
    -mixin Foo;
    +mixin Foo;
     
    -void test()
    +void test()
     {
    -    printf("x = %d\n", x);		// prints 4
    -    printf("bar() = %d\n", bar());	// prints 5
    +    printf("x = %d\n", x);		// prints 4
    +    printf("bar() = %d\n", bar());	// prints 5
     }
     
    diff -uNr dmd-0.156/dmd/html/d/module.html dmd-0.157/dmd/html/d/module.html --- dmd-0.156/dmd/html/d/module.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/module.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,105 +57,73 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -

    Modules

    -
    -Module:
    +
    Module:
     	ModuleDeclaration DeclDefs
     	DeclDefs
     
    @@ -183,7 +151,6 @@
     
    - Modules have a one-to-one correspondence with source files. The module name is the file name with the path and extension stripped off. @@ -216,8 +183,7 @@ package it belongs to. If absent, the module name is taken to be the same name (stripped of path and extension) of the source file name. -
    -ModuleDeclaration:
    +
    ModuleDeclaration:
     	module ModuleName ;
     
     ModuleName:
    @@ -225,7 +191,6 @@
     	ModuleName . Identifier
     
    - The Identifier preceding the rightmost are the packages that the module is in. The packages correspond to directory names in the source file path. @@ -237,7 +202,7 @@ Example: -
    module c.stdio;    // this is module <b>stdio</b> in the <b>c</b> package
    +
    module c.stdio;    // this is module <b>stdio</b> in the <b>c</b> package
     
    By convention, package and module names are all lower case. This is @@ -251,8 +216,7 @@ Rather than text include files, D imports symbols symbolically with the import declaration: -
    -ImportDeclaration:
    +
    ImportDeclaration:
     	import ModuleNameList ;
     
     ModuleNameList:
    @@ -260,15 +224,14 @@
     	ModuleName , ModuleNameList
     
    - The rightmost Identifier becomes the module name. The top level scope in the module is merged with the current scope.

    Example: -

    import std.c.stdio;  // import module <b>stdio</b> from the <b>c</b> package
    -import foo, bar;     // import modules <b>foo</b> and <b>bar</b>
    +
    import std.c.stdio;  // import module <b>stdio</b> from the <b>c</b> package
    +import foo, bar;     // import modules <b>foo</b> and <b>bar</b>
     

    Scope and Modules

    @@ -282,47 +245,47 @@ For example, assume the following modules: -
    // Module foo
    -int x = 1;
    -int y = 2;
    -
    -// Module bar
    -int y = 3;
    -int z = 4;
    +
    // Module foo
    +int x = 1;
    +int y = 2;
    +
    +// Module bar
    +int y = 3;
    +int z = 4;
     
    then: -
    import foo;
    +
    import foo;
     ...
    -q = y;		// sets q to foo.y
    +q = y;		// sets q to foo.y
     
    and: -
    import foo;
    -int y = 5;
    -q = y;		// local y overrides foo.y
    +
    import foo;
    +int y = 5;
    +q = y;		// local y overrides foo.y
     
    and: -
    import foo;
    -import bar;
    -q = y;		// error: foo.y or bar.y?
    +
    import foo;
    +import bar;
    +q = y;		// error: foo.y or bar.y?
     
    and: -
    import foo;
    -import bar;
    -q = bar.y;	// q set to 3
    +
    import foo;
    +import bar;
    +q = bar.y;	// q set to 3
     
    If the import is private, such as: -
    module abc;
    -private import def;
    +
    module abc;
    +private import def;
     
    then def is not searched when another module imports abc. @@ -333,14 +296,14 @@ to access a name hidden by a local name. This is done with the global scope operator, which is a leading '.': -
    int x;
    +
    int x;
     
    -int foo(int x)
    +int foo(int x)
     {
    -    if (y)
    -	return x;		// returns foo.x, not global x
    -    else
    -	return .x;		// returns global x
    +    if (y)
    +	return x;		// returns foo.x, not global x
    +    else
    +	return .x;		// returns global x
     }
     
    diff -uNr dmd-0.156/dmd/html/d/operatoroverloading.html dmd-0.157/dmd/html/d/operatoroverloading.html --- dmd-0.156/dmd/html/d/operatoroverloading.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/operatoroverloading.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -223,14 +192,14 @@
    1. -
      class A { int opNeg(); }
      +
      class A { int opNeg(); }
       A a;
      --a;	// equivalent to a.opNeg();
      +-a;	// equivalent to a.opNeg();
       
    2. -
      class A { int opNeg(int i); }
      +
      class A { int opNeg(int i); }
       A a;
      --a;	// equivalent to a.opNeg(), which is an error
      +-a;	// equivalent to a.opNeg(), which is an error
       
    @@ -244,20 +213,20 @@ Overloading the cast operator does not affect implicit casts, it only applies to explicit casts. -
    struct A
    +
    struct A
     {
    -    int opCast() { return 28; }
    +    int opCast() { return 28; }
     }
     
    -void test()
    +void test()
     {
         A a;
     
    -    long i = cast(long)a;   // i is set to 28L
    -    void* p = cast(void*)a; // error, cannot implicitly
    -			    // convert int to void*
    -    int j = a;		    // error, cannot implicitly convert
    -			    // A to int
    +    long i = cast(long)a;   // i is set to 28L
    +    void* p = cast(void*)a; // error, cannot implicitly
    +			    // convert int to void*
    +    int j = a;		    // error, cannot implicitly convert
    +			    // A to int
     }
     
    @@ -496,41 +465,41 @@
    1. -
      class A { int opAdd(int i); }
      +
      class A { int opAdd(int i); }
       A a;
      -a + 1;	// equivalent to a.opAdd(1)
      -1 + a;	// equivalent to a.opAdd(1)
      +a + 1;	// equivalent to a.opAdd(1)
      +1 + a;	// equivalent to a.opAdd(1)
       
    2. -
      class B { int opDiv_r(int i); }
      +
      class B { int opDiv_r(int i); }
       B b;
      -1 / b;	// equivalent to b.opDiv_r(1)
      +1 / b;	// equivalent to b.opDiv_r(1)
       
    3. -
      class A { int opAdd(int i); }
      -class B { int opAdd_r(A a); }
      +
      class A { int opAdd(int i); }
      +class B { int opAdd_r(A a); }
       A a;
       B b;
      -a + 1;	// equivalent to a.opAdd(1)
      -a + b;	// equivalent to b.opAdd_r(a)
      -b + a;	// equivalent to b.opAdd_r(a)
      +a + 1;	// equivalent to a.opAdd(1)
      +a + b;	// equivalent to b.opAdd_r(a)
      +b + a;	// equivalent to b.opAdd_r(a)
       
    4. -
      class A { int opAdd(B b);  int opAdd_r(B b); }
      -class B { }
      +
      class A { int opAdd(B b);  int opAdd_r(B b); }
      +class B { }
       A a;
       B b;
      -a + b;	// equivalent to a.opAdd(b)
      -b + a;	// equivalent to a.opAdd_r(b)
      +a + b;	// equivalent to a.opAdd(b)
      +b + a;	// equivalent to a.opAdd_r(b)
       
    5. -
      class A { int opAdd(B b);  int opAdd_r(B b); }
      -class B { int opAdd_r(A a); }
      +
      class A { int opAdd(B b);  int opAdd_r(B b); }
      +class B { int opAdd_r(A a); }
       A a;
       B b;
      -a + b;	// ambiguous: a.opAdd(b) or b.opAdd_r(a)
      -b + a;	// equivalent to a.opAdd_r(b)
      +a + b;	// ambiguous: a.opAdd(b) or b.opAdd_r(a)
      +b + a;	// equivalent to a.opAdd_r(b)
       
    @@ -544,7 +513,7 @@ The member function opEquals() is defined as part of Object as: -
    int opEquals(Object o);
    +
    int opEquals(Object o);
     
    so that every class object has an opEquals(). @@ -565,7 +534,7 @@ The member function opCmp() is defined as part of Object as: -
    int opCmp(Object o);
    +
    int opCmp(Object o);
     
    so that every class object has a opCmp(). @@ -577,13 +546,13 @@ Note: Comparing a reference to a class object against null should be done as: -
    if (a is null)
    +
    if (a is null)
     
    and not as: -
    if (a == null)
    +
    if (a == null)
     
    The latter is converted to: -
    if (a.opCmp(null))
    +
    if (a.opCmp(null))
     
    which will fail if opCmp() is a virtual function. @@ -595,12 +564,12 @@
  • For some objects, testing for less or greater makes no sense. For these, override opCmp() with: -
    class A
    +
    class A
     {
    -    int opCmp(Object o)
    +    int opCmp(Object o)
         {
    -	assert(0);	// comparison makes no sense
    -	return 0;
    +	assert(0);	// comparison makes no sense
    +	return 0;
         }
     }
     
    @@ -611,18 +580,18 @@ The function call operator, (), can be overloaded by declaring a function named opCall: -
    struct F
    +
    struct F
     {
    -    int opCall();
    -    int opCall(int x, int y, int z);
    +    int opCall();
    +    int opCall(int x, int y, int z);
     }
     
    -void test()
    +void test()
     {   F f;
    -    int i;
    +    int i;
     
    -    i = f();		// same as i = f.opCall();
    -    i = f(3,4,5);	// same as i = a.opCall(3,4,5);
    +    i = f();		// same as i = f.opCall();
    +    i = f(3,4,5);	// same as i = a.opCall(3,4,5);
     }
     
    @@ -641,18 +610,18 @@ named opIndexAssign with two or more parameters. The first parameter is the rvalue of the assignment expression. -
    struct A
    +
    struct A
     {
    -    int opIndex(size_t i1, size_t i2, size_t i3);
    -    int opIndexAssign(int value, size_t i1, size_t i2);
    +    int opIndex(size_t i1, size_t i2, size_t i3);
    +    int opIndexAssign(int value, size_t i1, size_t i2);
     }
     
    -void test()
    +void test()
     {   A a;
    -    int i;
    +    int i;
     
    -    i = a[5,6,7];	// same as i = a.opIndex(5,6,7);
    -    a[i,3] = 7;		// same as a.opIndexAssign(7,i,3);
    +    i = a[5,6,7];	// same as i = a.opIndex(5,6,7);
    +    a[i,3] = 7;		// same as a.opIndexAssign(7,i,3);
     }
     
    @@ -671,25 +640,25 @@ This can be done by declaring a function named opSlice. Assignment to a slice can be done by declaring opSliceAssign. -
    class A
    +
    class A
     {
    -    int opSlice();		 		  // overloads a[]
    -    int opSlice(size_t x, size_t y);		  // overloads a[i .. j]
    +    int opSlice();		 		  // overloads a[]
    +    int opSlice(size_t x, size_t y);		  // overloads a[i .. j]
     
    -    int opSliceAssign(int v);			  // overloads a[] = v
    -    int opSliceAssign(int v, size_t x, size_t y); // overloads a[i .. j] = v
    +    int opSliceAssign(int v);			  // overloads a[] = v
    +    int opSliceAssign(int v, size_t x, size_t y); // overloads a[i .. j] = v
     }
     
    -void test()
    -{   A a = new A();
    -    int i;
    -    int v;
    +void test()
    +{   A a = new A();
    +    int i;
    +    int v;
     
    -    i = a[];		// same as i = a.opSlice();
    -    i = a[3..4];	// same as i = a.opSlice(3,4);
    +    i = a[];		// same as i = a.opSlice();
    +    i = a[3..4];	// same as i = a.opSlice(3,4);
     
    -    a[] = v;		// same as a.opSliceAssign(v);
    -    a[3..4] = v;	// same as a.opSliceAssign(v,3,4);
    +    a[] = v;		// same as a.opSliceAssign(v);
    +    a[3..4] = v;	// same as a.opSliceAssign(v,3,4);
     }
     
    diff -uNr dmd-0.156/dmd/html/d/overview.html dmd-0.157/dmd/html/d/overview.html --- dmd-0.156/dmd/html/d/overview.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/overview.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
  • index a bit number, starting with bit 0 of p[0], and progressing. It addresses bits like the expression: -
    p[index / (uint.sizeof*8)] & (1 << (index & ((uint.sizeof*8) - 1)))
    +
    p
    +[index / (uint.sizeof*8)] & (1 << (index & ((uint.sizeof*8) - 1)))
     

    @@ -210,31 +217,31 @@

    Example:
    -

    import std.intrinsic;
    +
    import std.intrinsic;
     
    -int main()
    +int main()
     {
    -    uint array[2];
    +    uint array[2];
     
         array[0] = 2;
         array[1] = 0x100;
     
    -    printf("btc(array, 35) = %d\n", <b>btc</b>(array, 35));
    -    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
    +    printf("btc(array, 35) = %d\n", <b>btc</b>(array, 35));
    +    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
     
    -    printf("btc(array, 35) = %d\n", <b>btc</b>(array, 35));
    -    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
    +    printf("btc(array, 35) = %d\n", <b>btc</b>(array, 35));
    +    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
     
    -    printf("bts(array, 35) = %d\n", <b>bts</b>(array, 35));
    -    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
    +    printf("bts(array, 35) = %d\n", <b>bts</b>(array, 35));
    +    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
     
    -    printf("btr(array, 35) = %d\n", <b>btr</b>(array, 35));
    -    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
    +    printf("btr(array, 35) = %d\n", <b>btr</b>(array, 35));
    +    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
     
    -    printf("bt(array, 1) = %d\n", <b>bt</b>(array, 1));
    -    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
    +    printf("bt(array, 1) = %d\n", <b>bt</b>(array, 1));
    +    printf("array = [0]:x%x, [1]:x%x\n", array[0], array[1]);
     
    -    return 0;
    +    return 0;
     }
     


    diff -uNr dmd-0.156/dmd/html/d/phobos/std_math.html dmd-0.157/dmd/html/d/phobos/std_math.html --- dmd-0.156/dmd/html/d/phobos/std_math.html 2006-04-28 00:08:34.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_math.html 2006-05-10 12:07:46.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:33 2006 +
    Last update Wed May 10 12:07:45 2006
    @@ -420,8 +420,16 @@
    Calculates the inverse hyperbolic sine of x.

    Mathematically, -
      asinh(x) =  log( x + sqrt( x*x + 1 )) // if x >= +0
    -  asinh(x) = -log(-x + sqrt( x*x + 1 )) // if x <= -0
    +
      asinh(x
    +) =  log( x
    + + sqrt( x
    +*x
    + + 1 )) // if x >= +0
    +  asinh(x
    +) = -log(-x
    + + sqrt( x
    +*x
    + + 1 )) // if x <= -0
     
    @@ -668,7 +676,9 @@ For a positive, finite x:

    -
     1 <= x * FLT_RADIX-logb(x) < FLT_RADIX
    +
     1 <= x
    + * FLT_RADIX-logb(x
    +) < FLT_RADIX
     
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_md5.html dmd-0.157/dmd/html/d/phobos/std_md5.html --- dmd-0.156/dmd/html/d/phobos/std_md5.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_md5.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:34 2006 +
    Last update Wed May 10 12:07:47 2006
    @@ -132,43 +132,43 @@

    Example:
    -
    // This code is derived from the
    -// RSA Data Security, Inc. MD5 Message-Digest Algorithm.
    +
    // This code is derived from the
    +// RSA Data Security, Inc. MD5 Message-Digest Algorithm.
     
    -import std.md5;
    +import std.md5;
     
    -private import std.stdio;
    -private import std.string;
    -private import std.c.stdio;
    -private import std.c.string;
    +private import std.stdio;
    +private import std.string;
    +private import std.c.stdio;
    +private import std.c.string;
     
    -int main(char[][] args)
    +int main(char[][] args)
     {
    -    foreach (char[] arg; args)
    +    foreach (char[] arg; args)
     	 MDFile(arg);
    -    return 0;
    +    return 0;
     }
     
    -/* Digests a file and prints the result. */
    -void MDFile(char[] filename)
    +/* Digests a file and prints the result. */
    +void MDFile(char[] filename)
     {
         FILE* file;
         MD5_CTX context;
    -    int len;
    -    ubyte[4 * 1024] buffer;
    -    ubyte digest[16];
    -
    -    if ((file = fopen(std.string.toStringz(filename), "rb")) == null)
    -	writefln("%s can't be opened", filename);
    -    else
    +    int len;
    +    ubyte[4 * 1024] buffer;
    +    ubyte digest[16];
    +
    +    if ((file = fopen(std.string.toStringz(filename), "rb")) == null)
    +	writefln("%s can't be opened", filename);
    +    else
         {
     	context.start();
    -	while ((len = fread(buffer, 1, buffer.sizeof, file)) != 0)
    +	while ((len = fread(buffer, 1, buffer.sizeof, file)) != 0)
     	    context.update(buffer[0 .. len]);
     	context.finish(digest);
     	fclose(file);
     
    -	writefln("MD5 (%s) = %s", filename, digestToString(digest));
    +	writefln("MD5 (%s) = %s", filename, digestToString(digest));
         }
     }
     
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_mmfile.html dmd-0.157/dmd/html/d/phobos/std_mmfile.html --- dmd-0.156/dmd/html/d/phobos/std_mmfile.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_mmfile.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:35 2006 +
    Last update Wed May 10 12:07:49 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_openrj.html dmd-0.157/dmd/html/d/phobos/std_openrj.html --- dmd-0.156/dmd/html/d/phobos/std_openrj.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_openrj.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:35 2006 +
    Last update Wed May 10 12:07:49 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_outbuffer.html dmd-0.157/dmd/html/d/phobos/std_outbuffer.html --- dmd-0.156/dmd/html/d/phobos/std_outbuffer.html 2006-04-28 00:08:34.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_outbuffer.html 2006-05-10 12:07:46.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:33 2006 +
    Last update Wed May 10 12:07:45 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_path.html dmd-0.157/dmd/html/d/phobos/std_path.html --- dmd-0.156/dmd/html/d/phobos/std_path.html 2006-04-28 00:08:34.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_path.html 2006-05-10 12:07:46.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:33 2006 +
    Last update Wed May 10 12:07:44 2006
    @@ -179,16 +179,16 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     getExt(r"d:\path\foo.bat") // "bat"
    -     getExt(r"d:\path.two\bar") // null
    +     getExt(r"d:\path\foo.bat") // "bat"
    +     getExt(r"d:\path.two\bar") // null
      }
    - version(linux)
    + version(linux)
      {
    -     getExt(r"/home/user.name/bar.")  // ""
    -     getExt(r"d:\\path.two\\bar")     // "two\\bar"
    -     getExt(r"/home/user/.resource")  // "resource"
    +     getExt(r"/home/user.name/bar.")  // ""
    +     getExt(r"d:\\path.two\\bar")     // "two\\bar"
    +     getExt(r"/home/user/.resource")  // "resource"
      }
     
    @@ -216,16 +216,16 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     getName(r"d:\path\foo.bat") => "d:\path\foo"
    -     getName(r"d:\path.two\bar") => null
    +     getName(r"d:\path\foo.bat") => "d:\path\foo"
    +     getName(r"d:\path.two\bar") => null
      }
    - version(linux)
    + version(linux)
      {
    -     getName("/home/user.name/bar.")  => "/home/user.name/bar"
    -     getName(r"d:\path.two\bar") => "d:\path"
    -     getName("/home/user/.resource") => "/home/user/"
    +     getName("/home/user.name/bar.")  => "/home/user.name/bar"
    +     getName(r"d:\path.two\bar") => "d:\path"
    +     getName("/home/user/.resource") => "/home/user/"
      }
     
    @@ -252,13 +252,13 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     getBaseName(r"d:\path\foo.bat") => "foo.bat"
    +     getBaseName(r"d:\path\foo.bat") => "foo.bat"
      }
    - version(linux)
    + version(linux)
      {
    -     getBaseName("/home/user.name/bar.")  => "bar."
    +     getBaseName("/home/user.name/bar.")  => "bar."
      }
     
    @@ -289,15 +289,15 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     getDirName(r"d:\path\foo.bat") => "d:\path"
    -     getDirName(getDirName(r"d:\path\foo.bat")) => "d:\"
    +     getDirName(r"d:\path\foo.bat") => "d:\path"
    +     getDirName(getDirName(r"d:\path\foo.bat")) => "d:\"
      }
      version(linux)
      {
    -     getDirName(")/home/user"  => "/home"
    -     getDirName(getDirName(")/home/user")  => ""
    +     getDirName(")/home/user"  => "/home"
    +     getDirName(getDirName(")/home/user")  => ""
      }
     
    @@ -324,7 +324,7 @@

    Examples:
    -
     getDrive(r"d:\path\foo.bat") => "d:"
    +
     getDrive(r"d:\path\foo.bat") => "d:"
     


    @@ -350,9 +350,9 @@

    Examples:
    -
     defaultExt("foo.txt", "raw") => "foo.txt"
    - defaultExt("foo.", "raw") => "foo.raw"
    - defaultExt("bar", "raw") => "bar.raw"
    +
     defaultExt("foo.txt", "raw") => "foo.txt"
    + defaultExt("foo.", "raw") => "foo.raw"
    + defaultExt("bar", "raw") => "bar.raw"
     


    @@ -380,9 +380,9 @@

    Examples:
    -
     addExt("foo.txt", "raw") => "foo.raw"
    - addExt("foo.", "raw") => "foo.raw"
    - addExt("bar", "raw") => "bar.raw"
    +
     addExt("foo.txt", "raw") => "foo.raw"
    + addExt("foo.", "raw") => "foo.raw"
    + addExt("bar", "raw") => "bar.raw"
     


    @@ -403,16 +403,16 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     isabs(r"relative\path") => 0
    -     isabs(r"\relative\path") => 0
    -     isabs(r"d:\absolute") => 1
    +     isabs(r"relative\path") => 0
    +     isabs(r"\relative\path") => 0
    +     isabs(r"d:\absolute") => 1
      }
    - version(linux)
    + version(linux)
      {
    -     isabs("/home/user") => 1
    -     isabs("foo") => 0
    +     isabs("/home/user") => 1
    +     isabs("foo") => 0
      }
     
    @@ -437,15 +437,15 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     join(r"c:\foo", "bar") => "c:\foo\bar"
    -     join("foo", r"d:\bar") => "d:\bar"
    +     join(r"c:\foo", "bar") => "c:\foo\bar"
    +     join("foo", r"d:\bar") => "d:\bar"
      }
    - version(linux)
    + version(linux)
      {
    -     join("/foo/", "bar") => "/foo/bar"
    -     join("/foo", "/bar") => "/bar"
    +     join("/foo/", "bar") => "/foo/bar"
    +     join("/foo", "/bar") => "/bar"
      }
     
    @@ -469,15 +469,15 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     fncharmatch('a', 'b') => 0
    -     fncharmatch('A', 'a') => 1
    +     fncharmatch('a', 'b') => 0
    +     fncharmatch('A', 'a') => 1
      }
    - version(linux)
    + version(linux)
      {
    -     fncharmatch('a', 'b') => 0
    -     fncharmatch('A', 'a') => 0
    +     fncharmatch('a', 'b') => 0
    +     fncharmatch('A', 'a') => 0
      }
     
    @@ -521,19 +521,19 @@

    Examples:
    -
     version(Win32)
    +
     version(Win32)
      {
    -     fnmatch("foo.bar", "*") => 1
    -     fnmatch(r"foo/foo\bar", "f*b*r") => 1
    -     fnmatch("foo.bar", "f?bar") => 0
    -     fnmatch("Goo.bar", "[fg]???bar") => 1
    -     fnmatch(r"d:\foo\bar", "d*foo?bar") => 1
    - }
    - version(linux)
    - {
    -     fnmatch("Go*.bar", "[fg]???bar") => 0
    -     fnmatch("/foo*home/bar", "?foo*bar") => 1
    -     fnmatch("foobar", "foo?bar") => 1
    +     fnmatch("foo.bar", "*") => 1
    +     fnmatch(r"foo/foo\bar", "f*b*r") => 1
    +     fnmatch("foo.bar", "f?bar") => 0
    +     fnmatch("Goo.bar", "[fg]???bar") => 1
    +     fnmatch(r"d:\foo\bar", "d*foo?bar") => 1
    + }
    + version(linux)
    + {
    +     fnmatch("Go*.bar", "[fg]???bar") => 0
    +     fnmatch("/foo*home/bar", "?foo*bar") => 1
    +     fnmatch("foobar", "foo?bar") => 1
      }
     
    @@ -580,23 +580,23 @@

    Examples:
    -
     import std.path;
    +
     import std.path;
     
    - void process_file(char[] filename)
    + void process_file(char[] filename)
      {
    -     char[] path = expandTilde(filename);
    +     char[] path = expandTilde(filename);
          ...
      }
     
    -
     import std.path;
    +
     import std.path;
     
    - const char[] RESOURCE_DIR_TEMPLATE = "~/.applicationrc";
    - char[] RESOURCE_DIR;    // This gets expanded in main().
    + const char[] RESOURCE_DIR_TEMPLATE = "~/.applicationrc";
    + char[] RESOURCE_DIR;    // This gets expanded in main().
     
    - int main(char[][] args)
    + int main(char[][] args)
      {
    -     RESOURCE_DIR = expandTilde(RESOURCE_DIR_TEMPLATE);
    +     RESOURCE_DIR = expandTilde(RESOURCE_DIR_TEMPLATE);
          ...
      }
     
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_process.html dmd-0.157/dmd/html/d/phobos/std_process.html --- dmd-0.156/dmd/html/d/phobos/std_process.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_process.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:35 2006 +
    Last update Wed May 10 12:07:49 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_random.html dmd-0.157/dmd/html/d/phobos/std_random.html --- dmd-0.156/dmd/html/d/phobos/std_random.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_random.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:34 2006 +
    Last update Wed May 10 12:07:46 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_regexp.html dmd-0.157/dmd/html/d/phobos/std_regexp.html --- dmd-0.156/dmd/html/d/phobos/std_regexp.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_regexp.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:49 2006
    @@ -277,18 +277,18 @@ corresponding RegExp if found, null if not.

    Example:
    -
     import std.stdio;
    - import std.regexp;
    +
     import std.stdio;
    + import std.regexp;
     
    - void main()
    + void main()
      {
    -     if (m; std.regexp.search("abcdef", "c"))
    +     if (m; std.regexp.search("abcdef", "c"))
          {
    -         writefln("%s[%s]%s", m.pre, m.match(0), m.post);
    +         writefln("%s[%s]%s", m.pre, m.match(0), m.post);
          }
      }
    - // Prints:
    - // ab[c]def
    + // Prints:
    + // ab[c]def
     


    @@ -346,21 +346,21 @@ search() returns instance of RegExp set up to search string[].

    Example:
    -
     import std.stdio;
    - import std.regexp;
    +
     import std.stdio;
    + import std.regexp;
     
    - void main()
    + void main()
      {
    -     foreach(m; RegExp("ab").search("abcabcabab"))
    +     foreach(m; RegExp("ab").search("abcabcabab"))
          {
    -         writefln("%s[%s]%s", m.pre, m.match(0), m.post);
    +         writefln("%s[%s]%s", m.pre, m.match(0), m.post);
          }
      }
    - // Prints:
    - // [ab]cabcabab
    - // abc[ab]cabab
    - // abcabc[ab]ab
    - // abcabcab[ab]
    + // Prints:
    + // [ab]cabcabab
    + // abc[ab]cabab
    + // abcabc[ab]ab
    + // abcabcab[ab]
     


    diff -uNr dmd-0.156/dmd/html/d/phobos/std_socket.html dmd-0.157/dmd/html/d/phobos/std_socket.html --- dmd-0.156/dmd/html/d/phobos/std_socket.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_socket.html 2006-05-10 12:07:50.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:49 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_socketstream.html dmd-0.157/dmd/html/d/phobos/std_socketstream.html --- dmd-0.156/dmd/html/d/phobos/std_socketstream.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_socketstream.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_stdint.html dmd-0.157/dmd/html/d/phobos/std_stdint.html --- dmd-0.156/dmd/html/d/phobos/std_stdint.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_stdint.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_stdio.html dmd-0.157/dmd/html/d/phobos/std_stdio.html --- dmd-0.156/dmd/html/d/phobos/std_stdio.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_stdio.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_stream.html dmd-0.157/dmd/html/d/phobos/std_stream.html --- dmd-0.156/dmd/html/d/phobos/std_stream.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_stream.html 2006-05-10 12:07:46.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:34 2006 +
    Last update Wed May 10 12:07:45 2006
    @@ -250,9 +250,9 @@ Breaking out of the foreach will leave the stream position at the beginning of the next line to be read. For example, to echo a file line-by-line with line numbers run: -
     Stream file = new BufferedFile("sample.txt");
    - foreach(ulong n, char[] line; file) {
    -   stdout.writefln("line %d: %s",n,line);
    +
     Stream file = new BufferedFile("sample.txt");
    + foreach(ulong n, char[] line; file) {
    +   stdout.writefln("line %d: %s",n,line);
      }
      file.close();
     
    @@ -315,12 +315,12 @@ (possibly with appending characters) and a slice of the result is assigned back into the argument. For example the following readf statements are equivalent: -
     int x;
    - double y;
    - char[] s;
    - file.readf(&x, " hello ", &y, &s);
    - file.readf("%d hello %f %s", &x, &y, &s);
    - file.readf("%d hello %f", &x, &y, "%s", &s);
    +
     int x;
    + double y;
    + char[] s;
    + file.readf(&x, " hello ", &y, &s);
    + file.readf("%d hello %f %s", &x, &y, &s);
    + file.readf("%d hello %f", &x, &y, "%s", &s);
     


    diff -uNr dmd-0.156/dmd/html/d/phobos/std_string.html dmd-0.157/dmd/html/d/phobos/std_string.html --- dmd-0.156/dmd/html/d/phobos/std_string.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_string.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:34 2006 +
    Last update Wed May 10 12:07:46 2006
    @@ -219,9 +219,9 @@

    Returns:
    - + +
    < 0 s1 < s2 -
    = 0 s1 == s2 -
    > 0 s1 > s2 +
    < 0 s1 < s2
    = 0 s1 == s2
    > 0 s1 > s2


    diff -uNr dmd-0.156/dmd/html/d/phobos/std_system.html dmd-0.157/dmd/html/d/phobos/std_system.html --- dmd-0.156/dmd/html/d/phobos/std_system.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_system.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_thread.html dmd-0.157/dmd/html/d/phobos/std_thread.html --- dmd-0.156/dmd/html/d/phobos/std_thread.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_thread.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_uni.html dmd-0.157/dmd/html/d/phobos/std_uni.html --- dmd-0.156/dmd/html/d/phobos/std_uni.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_uni.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_uri.html dmd-0.157/dmd/html/d/phobos/std_uri.html --- dmd-0.156/dmd/html/d/phobos/std_uri.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_uri.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_utf.html dmd-0.157/dmd/html/d/phobos/std_utf.html --- dmd-0.156/dmd/html/d/phobos/std_utf.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_utf.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_windows_charset.html dmd-0.157/dmd/html/d/phobos/std_windows_charset.html --- dmd-0.156/dmd/html/d/phobos/std_windows_charset.html 2006-04-28 00:08:38.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_windows_charset.html 2006-05-10 12:07:52.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:36 2006 +
    Last update Wed May 10 12:07:50 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_zip.html dmd-0.157/dmd/html/d/phobos/std_zip.html --- dmd-0.156/dmd/html/d/phobos/std_zip.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_zip.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:35 2006 +
    Last update Wed May 10 12:07:47 2006
    @@ -288,10 +288,10 @@

    Example:
    All the members of the archive can be accessed with a foreach loop: -
     ZipArchive archive = new ZipArchive(data);
    - foreach (ArchiveMember am; archive.directory)
    +
     ZipArchive archive = new ZipArchive(data);
    + foreach (ArchiveMember am; archive.directory)
      {
    -     writefln("member name is '%s'", am.name);
    +     writefln("member name is '%s'", am.name);
      }
     
    diff -uNr dmd-0.156/dmd/html/d/phobos/std_zlib.html dmd-0.157/dmd/html/d/phobos/std_zlib.html --- dmd-0.156/dmd/html/d/phobos/std_zlib.html 2006-04-28 00:08:36.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/std_zlib.html 2006-05-10 12:07:48.000000000 +0200 @@ -24,7 +24,7 @@ | D | Comments -
    Last update Fri Apr 28 00:08:35 2006 +
    Last update Wed May 10 12:07:47 2006
    diff -uNr dmd-0.156/dmd/html/d/phobos/style.css dmd-0.157/dmd/html/d/phobos/style.css --- dmd-0.156/dmd/html/d/phobos/style.css 2005-09-28 01:58:44.000000000 +0200 +++ dmd-0.157/dmd/html/d/phobos/style.css 2006-05-03 11:47:10.000000000 +0200 @@ -47,6 +47,12 @@ color: #000066; } +.d_comment { color: green; } +.d_string { color: red; } +.d_keyword { color: blue; } +.d_psymbol { text-decoration: underline; } +.d_param { font-style: italic; } + body#toc { background: #dddddd; diff -uNr dmd-0.156/dmd/html/d/portability.html dmd-0.157/dmd/html/d/portability.html --- dmd-0.156/dmd/html/d/portability.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/portability.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -199,7 +168,7 @@
  • If size dependencies are inevitable, put an assert in the code to verify it: -
    assert(int.sizeof == (int*).sizeof);
    +
    assert(int.sizeof == (int*).sizeof);
     
    diff -uNr dmd-0.156/dmd/html/d/pragma.html dmd-0.157/dmd/html/d/pragma.html --- dmd-0.156/dmd/html/d/pragma.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/pragma.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,133 +57,100 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
  • Pragmas

    -
    -Pragma:
    +
    Pragma:
         pragma ( Identifier )
         pragma ( Identifier , ExpressionList )
     
    - Pragmas are a way to pass special information to the compiler and to add vendor specific extensions to D. Pragmas can be used by themselves terminated with a ';', they can influence a statement, a block of statements, a declaration, or a block of declarations. -
    pragma(ident);		   // just by itself
    +
    pragma(ident);		   // just by itself
     
    -pragma(ident) declaration; // influence one declaration
    +pragma(ident) declaration; // influence one declaration
     
    -pragma(ident):		   // influence subsequent declarations
    +pragma(ident):		   // influence subsequent declarations
         declaration;
         declaration;
     
    -pragma(ident)		   // influence block of declarations
    +pragma(ident)		   // influence block of declarations
     {   declaration;
         declaration;
     }
     
    -pragma(ident) statement;   // influence one statement
    +pragma(ident) statement;   // influence one statement
     
    -pragma(ident)		   // influence block of statements
    +pragma(ident)		   // influence block of statements
     {   statement;
         statement;
     }
    @@ -205,7 +172,7 @@
         
    msg
    Prints a message while compiling, the AssignExpressions must be string literals: -
    pragma(msg, "compiling...");
    +
    pragma(msg, "compiling...");
     
    lib @@ -213,7 +180,7 @@ specified by the AssignExpression. The AssignExpressions must be a string literal: -
    pragma(lib, "foo.lib");
    +
    pragma(lib, "foo.lib");
     
    @@ -225,16 +192,16 @@ are prefixed by the vendor's trademarked name, in a similar manner to version identifiers: -
    pragma(DigitalMars_funky_extension) { ... }
    +
    pragma(DigitalMars_funky_extension) { ... }
     
    Compilers must diagnose an error for unrecognized Pragmas, even if they are vendor specific ones. This implies that vendor specific pragmas should be wrapped in version statements: -
    version (DigitalMars)
    +
    version (DigitalMars)
     {
    -    pragma(DigitalMars_funky_extension) { ... }
    +    pragma(DigitalMars_funky_extension) { ... }
     }
     
    diff -uNr dmd-0.156/dmd/html/d/pretod.html dmd-0.157/dmd/html/d/pretod.html --- dmd-0.156/dmd/html/d/pretod.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/pretod.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,28 +57,20 @@ · D vs C/C++/C#/Java
    - · Rationale for Builtins
    - · Converting C to D
    - · Converting C++ to D
    - · The C Preprocessor vs D
    - · D strings vs C++ std::string
    - · D complex vs C++ std::complex
    - · D Contract Programming vs C++
    -
    @@ -129,7 +121,7 @@ D uses symbolic imports: -
    import std.c.stdio;
    +
    import std.c.stdio;
     

    @@ -174,9 +166,9 @@ that get mapped onto externally defined data structures, there is a need, and it is handled with: -
    struct Foo
    +
    struct Foo
     {
    -	align (4):	// use 4 byte alignment
    +	align (4):	// use 4 byte alignment
     	...
     }
     
    @@ -223,7 +215,7 @@

    The D Way

    -
    const int VALUE = 5;
    +
    const int VALUE = 5;
     
  • Creating a list of values or flags: @@ -240,7 +232,7 @@

    The D Way

    -
    enum FLAGS { X = 0x1, Y = 0x2, Z = 0x4 };
    +
    enum FLAGS { X = 0x1, Y = 0x2, Z = 0x4 };
     FLAGS flags;
     ...
     flags |= FLAGS.X;
    @@ -264,7 +256,7 @@
     
     	

    The D Way

    -
    dchar[] h = "hello";
    +
    dchar[] h = "hello";
     
    @@ -298,7 +290,7 @@

    The D Way

    -
    alias int INT;
    +
    alias int INT;
     
  • Using one header file for both declaration and definition: @@ -333,7 +325,7 @@

    The D Way

    -
    int X(inout int i) { return i = i / 3; }
    +
    int X(inout int i) { return i = i / 3; }
     
    The compiler optimizer will inline it; no efficiency is lost. @@ -370,10 +362,10 @@ Calling conventions can be specified in blocks, so there's no need to change it for every function: -
    extern (Windows)
    +
    extern (Windows)
     {
    -    int onefunc();
    -    int anotherfunc();
    +    int onefunc();
    +    int anotherfunc();
     }
     
    @@ -410,15 +402,15 @@ D enables declarations of symbols that are aliases of other symbols: -
    version (UNICODE)
    +
    version (UNICODE)
     {
    -    int getValueW(wchar[] p);
    -    alias getValueW getValue;
    +    int getValueW(wchar[] p);
    +    alias getValueW getValue;
     }
    -else
    +else
     {
    -    int getValueA(char[] p);
    -    alias getValueA getValue;
    +    int getValueA(char[] p);
    +    alias getValueA getValue;
     }
     
    @@ -522,25 +514,25 @@ D neatly addresses this with nested functions: -
    ubyte* ip;		// byte code instruction pointer
    -int[] stack;		// operand stack
    -int spi;		// stack pointer
    +
    ubyte* ip;		// byte code instruction pointer
    +int[] stack;		// operand stack
    +int spi;		// stack pointer
     ...
     
    -int pop()        { return stack[--spi]; }
    -void push(int i) { stack[spi++] = i; }
    +int pop()        { return stack[--spi]; }
    +void push(int i) { stack[spi++] = i; }
     
    -while (1)
    +while (1)
     {
    -    switch (*ip++)
    +    switch (*ip++)
         {
    -	case ADD:
    +	case ADD:
     	    op1 = pop();
     	    op2 = pop();
     	    push(op1 + op2);
    -	    break;
    +	    break;
     
    -	case SUB:
    +	case SUB:
     	...
         }
     }
    @@ -610,27 +602,27 @@
     	which can be used anywhere a declaration
     	or a statement can be used. For example:
     
    -
    version (FOO)
    +
    version (FOO)
     {
    -    class Bar
    +    class Bar
         {
    -	const int x = 5;
    -	static assert(Bar.x == 5 || Bar.x == 6);
    +	const int x = 5;
    +	static assert(Bar.x == 5 || Bar.x == 6);
     
    -	void foo(T t)
    +	void foo(T t)
     	{
    -	    static assert(T.sizeof < 4);
    +	    static assert(T.sizeof < 4);
     	    ...
     	}
         }
     }
    -else version (BAR)
    +else version (BAR)
     {
         ...
     }
    -else
    +else
     {
    -    static assert(0);	// unsupported version
    +    static assert(0);	// unsupported version
     }
     
    diff -uNr dmd-0.156/dmd/html/d/property.html dmd-0.157/dmd/html/d/property.html --- dmd-0.156/dmd/html/d/property.html 2006-04-26 22:34:30.000000000 +0200 +++ dmd-0.157/dmd/html/d/property.html 2006-05-08 15:25:42.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:29 2006 +
    Last update Mon May 8 15:25:41 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
  • @@ -211,27 +180,27 @@ default initializer for that variable or field. For example: -
    int a;
    -int b = 1;
    -typedef int t = 2;
    +
    int a;
    +int b = 1;
    +typedef int t = 2;
     t c;
    -t d = cast(t)3;
    +t d = cast(t)3;
     
    -int.init	// is 0
    -a.init		// is 0
    -b.init		// is 1
    -t.init		// is 2
    -c.init		// is 2
    -d.init		// is 3
    +int.init	// is 0
    +a.init		// is 0
    +b.init		// is 1
    +t.init		// is 2
    +c.init		// is 2
    +d.init		// is 3
     
    -struct Foo
    +struct Foo
     {
    -    int a;
    -    int b = 7;
    +    int a;
    +    int b = 7;
     }
     
    -Foo.a.init	// is 0
    -Foo.b.init	// is 7
    +Foo.a.init	// is 0
    +Foo.b.init	// is 7
     

    Class and Struct Properties

    @@ -245,25 +214,25 @@ A simple property would be: -
    struct Foo
    +
    struct Foo
     {
    -    int data() { return m_data; }	// read property
    +    int data() { return m_data; }	// read property
     
    -    int data(int value) { return m_data = value; } // write property
    +    int data(int value) { return m_data = value; } // write property
     
    -  private:
    -    int m_data;
    +  private:
    +    int m_data;
     }
     
    To use it: -
    int test()
    +
    int test()
     {
         Foo f;
     
    -    f.data = 3;		// same as f.data(3);
    -    return f.data + 3;	// same as return f.data() + 3;
    +    f.data = 3;		// same as f.data(3);
    +    return f.data + 3;	// same as return f.data() + 3;
     }
     
    diff -uNr dmd-0.156/dmd/html/d/rationale.html dmd-0.157/dmd/html/d/rationale.html --- dmd-0.156/dmd/html/d/rationale.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/rationale.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:31 2006 +
    Last update Mon May 8 15:25:43 2006
    @@ -57,131 +57,94 @@ · Overview
    - · D for Win32
    - · Win32 DLLs in D
    - · C .h to D Modules
    - · FAQ
    - · Style Guide
    - · Example: wc
    - · Future
    - · D Change Log
    - · Tech Tips
    - · Rationale
    - · Warnings
    -
    Articles
    · Exception Safety
    - · Templates Revisited
    -
    Tools
    · DMD D Compiler
    - · GDC D Compiler
    - · Linker
    - · Profiler
    - · Code Coverage
    - · DMD Script Shell
    - · Windows Debugger
    -
    Community
    · News
    - · Forum
    - · Announcements
    - · Learn
    - · D links
    -
    Archives
    · digitalmars.D
    - · digitalmars.D.dtl
    - · digitalmars.D.announce
    - · digitalmars.D.dwt
    - · digitalmars.D.learn
    - · digitalmars.D.bugs
    - · D.gnu
    - · Old D
    -
    Appendices
    · Glossary
    - · Ascii Table
    - · Acknowledgements
    -
    @@ -189,26 +158,26 @@

    Labelled Statements

    - Statements can be labelled. A label is an identifier that +

    Statements can be labelled. A label is an identifier that precedes a statement. +

    LabelledStatement:
         Identifier ':' Statement
     
    - Any statement can be labelled, including empty statements, +

    Any statement can be labelled, including empty statements, and so can serve as the target of a goto statement. Labelled statements can also serve as the target of a break or continue statement. -

    - - Labels are in a name space independent of declarations, variables, +

    +

    Labels are in a name space independent of declarations, variables, types, etc. Even so, labels cannot have the same name as local declarations. The label name space is the body of the function they appear in. Label name spaces do not nest, i.e. a label inside a block statement is accessible from outside that block. - +

    Block Statement

    @@ -221,46 +190,47 @@ Statement StatementList - A block statement is a sequence of statements enclosed +

    A block statement is a sequence of statements enclosed by { }. The statements are executed in lexical order. -

    - - A block statement introduces a new scope for local +

    +

    A block statement introduces a new scope for local symbols. A local symbol's name, however, must be unique within the function. +

    -
    void func1(int x)
    -{   int x;	// illegal, x is multiply defined in function scope
    +
    void func1(int x)
    +{   int x;	// illegal, x is multiply defined in function scope
     }
     
    -void func2()
    +void func2()
     {
    -    int x;
    +    int x;
     
    -    {   int x;	// illegal, x is multiply defined in function scope
    +    {   int x;	// illegal, x is multiply defined in function scope
         }
     }
     
    -void func3()
    +void func3()
     {
    -    {   int x;
    +    {   int x;
         }
    -    {   int x;	// illegal, x is multiply defined in function scope
    +    {   int x;	// illegal, x is multiply defined in function scope
         }
     }
     
    -void func4()
    +void func4()
     {
    -    {   int x;
    +    {   int x;
         }
    -    {   x++;	// illegal, x is undefined
    +    {   x++;	// illegal, x is undefined
         }
     }
     
    - The idea is to avoid bugs in complex functions caused by +

    The idea is to avoid bugs in complex functions caused by scoped declarations inadvertently hiding previous ones. Local names should all be unique within a function. +

    Expression Statement

    @@ -274,22 +244,21 @@ Expressions that have no effect, like (x + x), are illegal in expression statements. - If such an expression is needed, casting it to void will + If such an expression is needed, casting it to void will make it legal. -
    int x;
    -x++;                // ok
    -x;                  // illegal
    -1+1;                // illegal
    -cast(void)(x + x);  // ok
    +
    int x;
    +x++;                // ok
    +x;                  // illegal
    +1+1;                // illegal
    +cast(void)(x + x);  // ok
     

    Declaration Statement

    Declaration statements declare and initialize variables. -
    -DeclarationStatement:
    +
    DeclarationStatement:
     	Type IdentifierList ;
     
     IdentifierList:
    @@ -301,7 +270,6 @@
     	Identifier = Initializer
     
    - If no Initializer is there to initialize the variable, it is initialized to the default value for its type. @@ -310,8 +278,10 @@ If statements provide simple conditional execution of statements.
    IfStatement:
    -	if ( IfCondition ) ThenStatement
    -	if ( IfCondition ) ThenStatement else ElseStatement
    +	if (
    + IfCondition ) ThenStatement
    +	if (
    + IfCondition ) ThenStatement else ElseStatement
     
     IfCondition:
     	Expression
    @@ -348,27 +318,28 @@
     	of the Expression. Its scope extends from when it is
     	initialized to the end of the ThenStatement.
     
    -
    import std.regexp;
    +
    import std.regexp;
     ...
    -if (auto m = std.regexp.search("abcdef", "b(c)d"))
    +if (auto m = std.regexp.search("abcdef", "b(c)d"))
     {
    -    writefln("[%s]", m.pre);      // prints [a]
    -    writefln("[%s]", m.post);     // prints [ef]
    -    writefln("[%s]", m.match(0)); // prints [bcd]
    -    writefln("[%s]", m.match(1)); // prints [c]
    -    writefln("[%s]", m.match(2)); // prints []
    +    writefln("[%s]", m.pre);      // prints [a]
    +    writefln("[%s]", m.post);     // prints [ef]
    +    writefln("[%s]", m.match(0)); // prints [bcd]
    +    writefln("[%s]", m.match(1)); // prints [c]
    +    writefln("[%s]", m.match(2)); // prints []
     }
    -else
    +else
     {
    -    writefln(m.post);    // error, m undefined
    +    writefln(m.post);    // error, m undefined
     }
    -writefln(m.pre);         // error, m undefined
    +writefln(m.pre);         // error, m undefined
     

    While Statement

    WhileStatement:
    -    while ( Expression ) Statement
    +    while (
    + Expression ) Statement
     
    While statements implement simple loops. @@ -380,8 +351,8 @@ Statement is executed again. This continues until the Expression evaluates to false. -
    int i = 0;
    -while (i < 10)
    +
    int i = 0;
    +while (i < 10)
     {
         foo(i);
         i++;
    @@ -395,7 +366,8 @@
     

    Do While Statement

    DoStatement:
    -    do Statement while ( Expression )
    +    do Statement while (
    + Expression )
     
    Do while statements implement simple loops. @@ -407,11 +379,11 @@ This continues until the Expression evaluates to false. -
    int i = 0;
    -do
    +
    int i = 0;
    +do
     {
         foo(i);
    -} while (++i < 10);
    +} while (++i < 10);
     
    A BreakStatement will exit the loop. @@ -423,9 +395,9 @@ For statements implement loops with initialization, test, and increment clauses. -
    -ForStatement:
    -	for (Initialize; Test; Increment) Statement
    +
    ForStatement:
    +	for (
    +Initialize; Test; Increment) Statement
     
     Initialize:
     	empty
    @@ -441,7 +413,6 @@
     	Expression
     
    - Initializer is executed. Test is evaluated and must have a type that can be converted to a boolean. If it's true the @@ -459,27 +430,27 @@ If Initializer declares a variable, that variable's scope extends through the end of Statement. For example: -
    for (int i = 0; i < 10; i++)
    +
    for (int i = 0; i < 10; i++)
     	foo(i);
     
    is equivalent to: -
    {   int i;
    -    for (i = 0; i < 10; i++)
    +
    {   int i;
    +    for (i = 0; i < 10; i++)
     	foo(i);
     }
     
    Function bodies cannot be empty: -
    for (int i = 0; i < 10; i++)
    -	;	// illegal
    +
    for (int i = 0; i < 10; i++)
    +	;	// illegal
     
    Use instead: -
    for (int i = 0; i < 10; i++)
    +
    for (int i = 0; i < 10; i++)
     {
     }
     
    @@ -492,7 +463,8 @@ A foreach statement loops over the contents of an aggregate.
    ForeachStatement:
    -	foreach (ForeachTypeList; Expression) Statement
    +	foreach (
    +ForeachTypeList; Expression) Statement
     
     ForeachTypeList:
     	ForeachType
    @@ -530,11 +502,11 @@
     	must be of int or uint type, it cannot be inout,
     	and it is set to be the index of the array element.
     
    -
    char[] a;
    +
    char[] a;
     ...
    -foreach (int i, char c; a)
    +foreach (int i, char c; a)
     {
    -    printf("a[%d] = '%c'\n", i, c);
    +    printf("a[%d] = '%c'\n", i, c);
     }
     
    @@ -545,18 +517,18 @@ In this manner any UTF array can be decoded into any UTF type: -
    char[] a = "\xE2\x89\xA0";	// \u2260 encoded as 3 UTF-8 bytes
    +
    char[] a = "\xE2\x89\xA0";	// \u2260 encoded as 3 UTF-8 bytes
     
    -foreach (dchar c; a)
    +foreach (dchar c; a)
     {
    -    printf("a[] = %x\n", c);	// prints 'a[] = 2260'
    +    printf("a[] = %x\n", c);	// prints 'a[] = 2260'
     }
     
    -dchar[] b = "\u2260";
    +dchar[] b = "\u2260";
     
    -foreach (char c; b)
    +foreach (char c; b)
     {
    -    printf("%x, ", c);	// prints 'e2, 89, a0'
    +    printf("%x, ", c);	// prints 'e2, 89, a0'
     }
     
    @@ -572,11 +544,11 @@ array. It cannot be inout, and it is set to be the index of the array element. -
    double[char[]] a;	// index type is char[], value type is double
    +
    double[char[]] a;	// index type is char[], value type is double
     ...
    -foreach (char[] s, double d; a)
    +foreach (char[] s, double d; a)
     {
    -    printf("a['%.*s'] = %g\n", s, d);
    +    printf("a['%.*s'] = %g\n", s, d);
     }
     
    @@ -590,7 +562,7 @@ If the aggregate is a struct or a class object, that struct or class must have an opApply function with the type: -
    int opApply(int delegate(inout Type [, ...]) dg);
    +
    int opApply(int delegate(inout Type [, ...]) dg);
     
    where Type matches the Type used in the foreach @@ -611,36 +583,36 @@ For example, consider a class that is a container for two elements: -
    class Foo
    +
    class Foo
     {
    -    uint array[2];
    +    uint array[2];
     
    -    int opApply(int delegate(inout uint) dg)
    -    {   int result = 0;
    +    int opApply(int delegate(inout uint) dg)
    +    {   int result = 0;
     
    -	for (int i = 0; i < array.length; i++)
    +	for (int i = 0; i < array.length; i++)
     	{
     	    result = dg(array[i]);
    -	    if (result)
    -		break;
    +	    if (result)
    +		break;
     	}
    -	return result;
    +	return result;
         }
     }
     
    An example using this might be: -
    void test()
    +
    void test()
     {
    -    Foo a = new Foo();
    +    Foo a = new Foo();
     
         a.array[0] = 73;
         a.array[1] = 82;
     
    -    foreach (uint u; a)
    +    foreach (uint u; a)
         {
    -	printf("%d\n", u);
    +	printf("%d\n", u);
         }
     }
     
    @@ -654,15 +626,15 @@ Aggregates can be string literals, which can be accessed as char, wchar, or dchar arrays: -
    void test()
    +
    void test()
     {
    -    foreach (char c; "ab")
    +    foreach (char c; "ab")
         {
    -	printf("'%c'\n", c);
    +	printf("'%c'\n", c);
         }
    -    foreach (wchar w; "xy")
    +    foreach (wchar w; "xy")
         {
    -	wprintf("'%c'\n", w);
    +	wprintf("'%c'\n", w);
         }
     }
     
    @@ -677,17 +649,17 @@ inout can be used to update the original elements: -
    void test()
    +
    void test()
     {
    -    static uint[2] a = [7, 8];
    +    static uint[2] a = [7, 8];
     
    -    foreach (inout uint u; a)
    +    foreach (inout uint u; a)
         {
     	u++;
         }
    -    foreach (uint u; a)
    +    foreach (uint u; a)
         {
    -	printf("%d\n", u);
    +	printf("%d\n", u);
         }
     }
     
    @@ -704,15 +676,15 @@ reassigned or destructed while the foreach is iterating over the elements. -
    int[] a;
    -int[] b;
    -foreach (int i; a)
    -{
    -    a = null;		// error
    -    a.length += 10;	// error
    -    a = b;		// error
    +
    int[] a;
    +int[] b;
    +foreach (int i; a)
    +{
    +    a = null;		// error
    +    a.length += 10;	// error
    +    a = b;		// error
     }
    -a = null;		// ok
    +a = null;		// ok
     
    A BreakStatement in the body of the foreach will exit the @@ -725,9 +697,9 @@ statements depending on the value of the switch expression. -
    -SwitchStatement:
    -	switch ( Expression ) BlockStatement
    +
    SwitchStatement:
    +	switch (
    + Expression ) BlockStatement
     
     CaseStatement:
     	case ExpressionList : Statement
    @@ -736,7 +708,6 @@
     	default: Statement
     
    - Expression is evaluated. The result type T must be of integral type or char[], wchar[] or dchar[]. The result is compared against each of the case expressions. If there is @@ -771,13 +742,13 @@ can be nested within block statements; they do not have to be in the outermost block. For example, this is allowed: -
        switch (i)
    +
        switch (i)
         {
    -	case 1:
    +	case 1:
     	{
    -	    case 2:
    +	    case 2:
     	}
    -	    break;
    +	    break;
         }
     
    @@ -785,17 +756,17 @@ case values. A break statement will exit the switch BlockStatement. For example: -
    switch (i)
    +
    switch (i)
     {
    -    case 1:
    +    case 1:
     	x = 3;
    -    case 2:
    +    case 2:
     	x = 4;
    -	break;
    +	break;
     
    -    case 3,4,5:
    +    case 3,4,5:
     	x = 5;
    -	break;
    +	break;
     }
     
    @@ -805,12 +776,12 @@ Note: Unlike C and C++, strings can be used in switch expressions. For example: -
    char[] name;
    +
    char[] name;
     ...
    -switch (name)
    +switch (name)
     {
    -    case "fred":
    -    case "sally":
    +    case "fred":
    +    case "sally":
     	...
     }
     
    @@ -857,10 +828,10 @@ out of the finally clause, the continue target is never reached. -
    for (i = 0; i < 10; i++)
    +
    for (i = 0; i < 10; i++)
     {
    -    if (foo(i))
    -	continue;
    +    if (foo(i))
    +	continue;
         bar();
     }
     
    @@ -892,10 +863,10 @@ out of the finally clause, the break target is never reached. -
    for (i = 0; i < 10; i++)
    +
    for (i = 0; i < 10; i++)
     {
    -    if (foo(i))
    -	break;
    +    if (foo(i))
    +	break;
     }
     
    @@ -943,9 +914,9 @@ after the Expression is evaluated and before the function actually returns. -
    int foo(int x)
    +
    int foo(int x)
     {
    -    return x + 3;
    +    return x + 3;
     }
     
    @@ -961,8 +932,8 @@ A goto transfers to the statement labelled with Identifier. -
        if (foo)
    -	goto L1;
    +
        if (foo)
    +	goto L1;
         x = 3;
     L1:
         x++;
    @@ -981,17 +952,17 @@
     	CaseStatement of the innermost enclosing SwitchStatement
     	with a matching Expression.
     
    -
    switch (x)
    +
    switch (x)
     {
    -    case 3:
    -	goto case;
    -    case 4:
    -	goto default;
    -    case 5:
    -	goto case 4;
    -    default:
    +    case 3:
    +	goto case;
    +    case 4:
    +	goto default;
    +    case 5:
    +	goto case 4;
    +    default:
     	x = 4;
    -	break;
    +	break;
     }
     
    Any intervening finally clauses are executed, along with @@ -1006,20 +977,21 @@ The with statement is a way to simplify repeated references to the same object. -
    -WithStatement:
    -	with ( Expression ) BlockStatement
    -	with ( Symbol ) BlockStatement
    -	with ( TemplateInstance ) BlockStatement
    +
    WithStatement:
    +	with (
    + Expression ) BlockStatement
    +	with (
    + Symbol ) BlockStatement
    +	with (
    + TemplateInstance ) BlockStatement
     
    - where Expression evaluates to a class reference or struct instance. Within the with body the referenced object is searched first for identifier symbols. The WithStatement -
    with (expression)
    +
    with (expression)
     {
         ...
         ident;
    @@ -1045,15 +1017,15 @@
     	the corresponding scope is searched when looking up symbols.
     	For example:
     
    -
    struct Foo
    +
    struct Foo
     {
    -    typedef int Y;
    +    typedef int Y;
     }
     ...
    -Y y;		// error, Y undefined
    -with (Foo)
    +Y y;		// error, Y undefined
    +with (Foo)
     {
    -    Y y;	// same as Foo.Y y;
    +    Y y;	// same as Foo.Y y;
     }
     
    @@ -1062,13 +1034,12 @@ The synchronize statement wraps a statement with critical section to synchronize access among multiple threads. -
    -SynchronizeStatement:
    +
    SynchronizeStatement:
     	synchronized Statement
    -	synchronized ( Expression ) Statement
    +	synchronized (
    + Expression ) Statement
     
    - synchronized allows only one thread at a time to execute Statement.

    @@ -1085,7 +1056,7 @@ Example: -

    synchronized { ... }
    +
    synchronized { ... }
     
    This implements a standard critical section. @@ -1108,7 +1079,8 @@ catch BlockStatement Catch: - catch ( CatchParameter ) BlockStatement + catch ( + CatchParameter ) BlockStatement FinallyStatement: finally BlockStatement @@ -1142,25 +1114,25 @@ is not caught before the FinallyStatement is executed, the new exception replaces any existing exception: -
    int main()
    +
    int main()
     {
    -    try
    +    try
         {
    -	try
    +	try
     	{
    -	    throw new Exception("first");
    +	    throw new Exception("first");
     	}
    -	finally
    +	finally
     	{
    -	    printf("finally\n");
    -	    throw new Exception("second");
    +	    printf("finally\n");
    +	    throw new Exception("second");
     	}
         }
    -    catch(Exception e)
    +    catch(Exception e)
         {
    -	printf("catch %.*s\n", e.msg);
    +	printf("catch %.*s\n", e.msg);
         }
    -    printf("done\n");
    +    printf("done\n");
     }
     
    @@ -1189,7 +1161,7 @@ Expression is evaluated and must be an Object reference. The Object reference is thrown as an exception. -
    throw new Exception("message");
    +
    throw new Exception("message");
     

    Scope Statement

    @@ -1217,12 +1189,12 @@ scope, they also are interleaved with the ScopeStatements in the reverse lexical order in which they appear. -
    writef("1");
    +
    writef("1");
     {
    -    writef("2");
    -    scope(exit) writef("3");
    -    scope(exit) writef("4");
    -    writef("5");
    +    writef("2");
    +    scope(exit) writef("3");
    +    scope(exit) writef("4");
    +    writef("5");
     }
     writefln();
     
    @@ -1233,10 +1205,10 @@
    {
    -    scope(exit) writef("1");
    -    scope(success) writef("2");
    -    scope(exit) writef("3");
    -    scope(success) writef("4");
    +    scope(exit) writef("1");
    +    scope(success) writef("2");
    +    scope(exit) writef("3");
    +    scope(success) writef("4");
     }
     writefln();
     
    @@ -1246,24 +1218,24 @@
    4321
     
    -
    class Foo
    +
    class Foo
     {
    -    this() { writef("0"); }
    -    ~this() { writef("1"); }
    +    this() { writef("0"); }
    +    ~this() { writef("1"); }
     }
     
    -try
    +try
     {
    -    scope(exit) writef("2");
    -    scope(success) writef("3");
    -    auto Foo f = new Foo();
    -    scope(failure) writef("4");
    -    throw new Exception("msg");
    -    scope(exit) writef("5");
    -    scope(success) writef("6");
    -    scope(failure) writef("7");
    +    scope(exit) writef("2");
    +    scope(success) writef("3");
    +    auto Foo f = new Foo();
    +    scope(failure) writef("4");
    +    throw new Exception("msg");
    +    scope(exit) writef("5");
    +    scope(success) writef("6");
    +    scope(failure) writef("7");
     }
    -catch (Exception e)
    +catch (Exception e)
     {
     }
     writefln();
    @@ -1280,12 +1252,10 @@
     
     	No code motion occurs across volatile statement boundaries.
     
    -
    -VolatileStatement:
    +
    VolatileStatement:
     	volatile Statement
     
    - Statement is evaluated. Memory writes occurring before the Statement are performed before any reads within or after the Statement. @@ -1300,8 +1270,7 @@ Inline assembler is supported with the asm statement: -
    -AsmStatement:
    +
    AsmStatement:
     	asm { }
     	asm { AsmInstructionList }
     
    @@ -1310,7 +1279,6 @@
     	AsmInstruction ; AsmInstructionList
     
    - An asm statement enables the direct use of assembly language instructions. This makes it easy to obtain direct access to special CPU features without resorting to an external assembler. The @@ -1337,18 +1305,18 @@ For example, for the Intel Pentium: -
    int x = 3;
    -asm
    +
    int x = 3;
    +asm
     {
    -    mov	EAX,x;		// load x and put it in register EAX
    +    mov	EAX,x;		// load x and put it in register EAX
     }
     
    Inline assembler can be used to access hardware directly: -
    int gethardware()
    +
    int gethardware()
     {
    -    asm
    +    asm
         {
     	    mov	EAX, dword ptr 0x1234;
         }
    @@ -1359,16 +1327,16 @@
     	inline assembler makes no sense, and need not be implemented.
     	The version statement can be used to account for this:
     
    -
    version (D_InlineAsm_X86)
    +
    version (D_InlineAsm_X86)
     {
    -    asm
    +    asm
         {
     	...
         }
     }
    -else
    +else
     {
    -    /* ... some workaround ... */
    +    /* ... some workaround ... */
     }
     
    diff -uNr dmd-0.156/dmd/html/d/struct.html dmd-0.157/dmd/html/d/struct.html --- dmd-0.156/dmd/html/d/struct.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/struct.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
    @@ -193,7 +162,7 @@
  • no separate tag name space - tag names go into the current scope
  • declarations like: -
    struct ABC x;
    +
    struct ABC x;
     
    are not allowed, replace with: @@ -220,15 +189,15 @@ colon, expression syntax. The members may be initialized in any order. Members not specified in the initializer list are default initialized. -
    struct X { int a; int b; int c; int d = 7;}
    -static X x = { a:1, b:2};	      // c is set to 0, d to 7
    -static X z = { c:4, b:5, a:2 , d:5};  // z.a = 2, z.b = 5, z.c = 4, z.d = 5
    +
    struct X { int a; int b; int c; int d = 7;}
    +static X x = { a:1, b:2};	      // c is set to 0, d to 7
    +static X z = { c:4, b:5, a:2 , d:5};  // z.a = 2, z.b = 5, z.c = 4, z.d = 5
     
    C-style initialization, based on the order of the members in the struct declaration, is also supported: -
    static X q = { 1, 2 };	  // q.a = 1, q.b = 2, q.c = 0, q.d = 7
    +
    static X q = { 1, 2 };	  // q.a = 1, q.b = 2, q.c = 0, q.d = 7
     
    @@ -236,8 +205,8 @@ Unions are initialized explicitly. -
    union U { int a; double b; }
    -static U u = { b : 5.0 };		// u.b = 5.0
    +
    union U { int a; double b; }
    +static U u = { b : 5.0 };		// u.b = 5.0
     
    Other members of the union that overlay the initializer, diff -uNr dmd-0.156/dmd/html/d/style.css dmd-0.157/dmd/html/d/style.css --- dmd-0.156/dmd/html/d/style.css 2006-02-08 16:39:34.000000000 +0100 +++ dmd-0.157/dmd/html/d/style.css 2006-05-08 15:40:50.000000000 +0200 @@ -67,6 +67,12 @@ color: #000066; } +.d_comment { color: green; } +.d_string { color: red; } +.d_keyword { color: blue; } +.d_psymbol { text-decoration: underline; } +.d_param { font-style: italic; } + body#toc { background: #dddddd; @@ -172,3 +178,13 @@ margin-bottom: 1em; } +blockquote, +.quote{ + font-family: "courier new", courier, serif; + background: #DEDEDE url("quote.gif") no-repeat top right; + margin: 0.5em; + padding: 0.5em; + padding-left: 1em; + padding-top: 1em; +} + diff -uNr dmd-0.156/dmd/html/d/template.html dmd-0.157/dmd/html/d/template.html --- dmd-0.156/dmd/html/d/template.html 2006-04-26 22:34:32.000000000 +0200 +++ dmd-0.157/dmd/html/d/template.html 2006-05-08 15:25:44.000000000 +0200 @@ -25,7 +25,7 @@ | Comments -
    Last update Wed Apr 26 22:34:30 2006 +
    Last update Mon May 8 15:25:42 2006
    @@ -57,97 +57,66 @@ · Lexical
    - · Modules
    - · Declarations
    - · Types
    - · Properties
    - · Attributes
    - · Pragmas
    - · Expressions
    - · Statements
    - · Arrays
    - · Structs & Unions
    - · Classes
    - · Interfaces
    - · Enums
    - · Functions
    - · Operator Overloading
    - · Templates
    - · Mixins
    - · Contracts
    - · Conditional Compilation
    - · Handling errors
    - · Garbage Collection
    - · Memory Management
    - · Floating Point
    - · Inline Assembler
    - · Documentation Comments
    - · Interfacing To C
    - · Portability Guide
    - · Embedding D in HTML
    - · Named Character Entities
    - · Application Binary Interface
    -
  • @@ -159,11 +128,13 @@ I think that I can safely say that nobody understands template mechanics. -- Richard Deyman + Templates are D's approach to generic programming. Templates are defined with a TemplateDeclaration:
    TemplateDeclaration:
    -	template TemplateIdentifier ( TemplateParameterList )
    +	template TemplateIdentifier (
    + TemplateParameterList )
     		{ DeclDefs }
     
     TemplateIdentifier:
    @@ -244,7 +215,8 @@
     	Templates are explicitly instantiated with:
     
     
    TemplateInstance:
    -	TemplateIdentifer !( TemplateArgumentList )
    +	TemplateIdentifer !(
    + TemplateArgumentList )
     
     TemplateArgumentList:
     	TemplateArgument
    @@ -260,28 +232,28 @@
     	the template members, are in the scope
     	of the TemplateInstance:
     
    -
    template TFoo(T) { alias T* t; }
    +
    template TFoo(T) { alias T* t; }
     ...
    -TFoo!(int).t x;	// declare x to be of type int*
    +TFoo!(int).t x;	// declare x to be of type int*
     
    A template instantiation can be aliased: -
    template TFoo(T) { alias T* t; }
    -alias TFoo!(int) abc;
    -abc.t x;	// declare x to be of type int*
    +
    template TFoo(T) { alias T* t; }
    +alias TFoo!(int) abc;
    +abc.t x;	// declare x to be of type int*
     
    Multiple instantiations of a TemplateDeclaration with the same TemplateParameterList all will refer to the same instantiation. For example: -
    template TFoo(T) { T f; }
    -alias TFoo!(int) a;
    -alias TFoo!(int) b;
    +
    template TFoo(T) { T f; }
    +alias TFoo!(int) a;
    +alias TFoo!(int) b;
     ...
     a.f = 3;
    -assert(b.f == 3);	// a and b refer to the same instance of TFoo
    +assert(b.f == 3);	// a and b refer to the same instance of TFoo
     
    This is true even if the TemplateInstances are done in @@ -295,9 +267,9 @@ For example, a simple generic copy template would be: -
    template TCopy(T)
    +
    template TCopy(T)
     {
    -    void copy(out T to, T from)
    +    void copy(out T to, T from)
         {
     	to = from;
         }
    @@ -307,14 +279,15 @@
     	To use the template, it must first be instantiated with a specific
     	type:
     
    -
    int i;
    -TCopy!(int).copy(i, 3);
    +
    int i;
    +TCopy!(int).copy(i, 3);