offset | contents |
- 0 | array dimension |
- 4 | pointer to array data |
+offset | contents |
+0 | array dimension |
+size_t | pointer to array data |
-
- A dynamic array is declared as:
+
A dynamic array is declared as:
type[] array;
- whereas a static array is declared as:
+ whereas a static array is declared as:
type[dimension] array;
- Thus, a static array always has the dimension statically available as part of the type, and
+ Thus, a static array always has the dimension statically available as part of the type, and
so it is implemented like in C. Static array's and Dynamic arrays can be easily converted back
and forth to each other.
+
Associative Arrays
@@ -226,15 +231,17 @@
The current implementation is contained in phobos/internal/aaA.d.
+
Reference Types
- D has reference types, but they are implicit. For example, classes are always
+ D has reference types, but they are implicit. For example, classes are always
referred to by reference; this means that class instances can never reside on the stack
or be passed as function parameters.
-
+
- When passing a static array to a function, the result, although declared as a static array, will
+ 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[3] abc;
@@ -248,6 +255,7 @@
+
Name Mangling
D accomplishes typesafe linking by mangling a D identifier
@@ -268,8 +276,7 @@
The M means that the symbol is a function that requires
- a this
- pointer.
+ a this pointer.
Template Instance Names have the types and values of its parameters
encoded into it:
@@ -386,6 +393,7 @@
the number of characters in the Name.
+
Type Mangling
Types are mangled using a simple linear scheme:
@@ -555,6 +563,7 @@
B Number Arguments
+
Function Calling Conventions
The extern (C) calling convention matches the C calling convention
@@ -581,6 +590,8 @@
+
+
Return Value
+
+
Parameters
The parameters to the non-variadic function:
@@ -706,34 +719,47 @@
_argptr is not
passed, it is computed by the callee.
+
+
+
Exception Handling
Windows
- Conforms to the Microsoft Windows Structured Exception Handling
+ Conforms to the Microsoft Windows Structured Exception Handling
conventions.
- TBD
+
+
+
Linux
- Uses static address range/handler tables.
+ Uses static address range/handler tables.
TBD
+
+
+
+
Garbage Collection
- TBD
+ The interface to this is found in phobos/internal/gc.
+
Runtime Helper Functions
- TBD
+ These are found in phobos/internal.
+
Module Initialization and Termination
- TBD
+ TBD
+
Unit Testing
- TBD
+ TBD
+
diff -uNr dmd-0.177/dmd/html/d/acknowledgements.html dmd-0.178/dmd/html/d/acknowledgements.html
--- dmd-0.177/dmd/html/d/acknowledgements.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/acknowledgements.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:31 2006
+
Last update Sun Dec 10 22:56:56 2006
diff -uNr dmd-0.177/dmd/html/d/arrays.html dmd-0.178/dmd/html/d/arrays.html
--- dmd-0.177/dmd/html/d/arrays.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/arrays.html 2006-12-15 02:20:44.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:27 2006
+
Last update Fri Dec 15 02:20:42 2006
@@ -147,54 +147,57 @@
int* p;
- These are simple pointers to data, analogous to C pointers.
+ These are simple pointers to data, analogous to C pointers.
Pointers are provided for interfacing with C and for
specialized systems work.
There
is no length associated with it, and so there is no way for the
compiler or runtime to do bounds checking, etc., on it.
Most conventional uses for pointers can be replaced with
- dynamic arrays, out
- and inout
- parameters,
+ dynamic arrays, out and inout parameters,
and reference types.
+
Static Arrays
int[3] s;
- These are analogous to C arrays. Static arrays are distinguished
+ These are analogous to C arrays. Static arrays are distinguished
by having a length fixed at compile time.
-
+
- The total size of a static array cannot exceed 16Mb.
+ The total size of a static array cannot exceed 16Mb.
A dynamic array should be used instead for such large arrays.
-
+
- A static array with a dimension of 0 is allowed, but no
+ A static array with a dimension of 0 is allowed, but no
space is allocated for it. It's useful as the last member
of a variable length struct, or as the degenerate case of
a template expansion.
+
Dynamic Arrays
int[] a;
- Dynamic arrays consist of a length and a pointer to the array data.
+ Dynamic arrays consist of a length and a pointer to the array data.
Multiple dynamic arrays can share all or parts of the array data.
+
Array Declarations
- There are two ways to declare arrays, prefix and postfix.
+ There are two ways to declare arrays, prefix and postfix.
The prefix form is the preferred method, especially for
non-trivial types.
+
Prefix Array Declarations
- Prefix declarations appear before the identifier being
+ Prefix declarations appear before the identifier being
declared and read right to left, so:
+
int[] a; int[4][3] b; s[0..2] = t;
- Overlapping copies are an error:
+ Overlapping copies are an error:
s[0..2] = s[1..3]; s[1..3] = s[0..2];
- Disallowing overlapping makes it possible for more aggressive
+ Disallowing overlapping makes it possible for more aggressive
parallel code optimizations than possible with the serial
semantics of C.
+
Array Setting
- If a slice operator appears as the lvalue of an assignment
+ If a slice operator appears as the lvalue of an assignment
expression, and the type of the rvalue is the same as the element
type of the lvalue, then the lvalue's array contents
are set to the rvalue.
+
int[3] s;
int* p;
@@ -355,8 +368,9 @@
Array Concatenation
- The binary operator ~ is the cat operator. It is used
+ The binary operator ~ is the cat operator. It is used
to concatenate arrays:
+
int[] a;
int[] b;
@@ -366,26 +380,29 @@
- Many languages overload the + operator to mean concatenation.
+ Many languages overload the + operator to mean concatenation.
This confusingly leads to, does:
+
"10" + 3
- produce the number 13 or the string "103" as the result? It isn't
+ produce the number 13 or the string "103" as the result? It isn't
obvious, and the language designers wind up carefully writing rules
to disambiguate it - rules that get incorrectly implemented,
overlooked, forgotten, and ignored. It's much better to have + mean
addition, and a separate operator to be array concatenation.
-
+
- Similarly, the ~= operator means append, as in:
+ Similarly, the ~= operator means append, as in:
+
a ~= b;
- Concatenation always creates a copy of its operands, even
+ Concatenation always creates a copy of its operands, even
if one of the operands is a 0 length array, so:
+
a = b; a = b ~ c[0..0];
+ The implementation may use either opEquals or opCmp or
+ both. Care should be taken so that the results of
+ opEquals and opCmp are consistent with each other when
+ the class objects are the same or not.
+
Using Structs or Unions as the KeyType
Structs or unions can be used as the KeyType. For this to work,
the struct or union definition must define the following
member functions:
-
- hash_t toHash()
-
- - int opEquals(S)
- or int opEquals(S*)
-
- - int opCmp(S)
- or int opCmp(S*)
-
+ - hash_t toHash()
+ - int opEquals(S) or int opEquals(S*)
+ - int opCmp(S) or int opCmp(S*)
- Note that the parameter to opCmp
- and opEquals
-
+
Note that the parameter to opCmp and opEquals
can be either the struct or union type, or a pointer to the struct
or untion type.
@@ -1069,6 +1062,11 @@
}
+ The implementation may use either opEquals or opCmp or
+ both. Care should be taken so that the results of
+ opEquals and opCmp are consistent with each other when
+ the struct/union objects are the same or not.
+
Properties
Properties for associative arrays are:
diff -uNr dmd-0.177/dmd/html/d/ascii-table.html dmd-0.178/dmd/html/d/ascii-table.html
--- dmd-0.177/dmd/html/d/ascii-table.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/ascii-table.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:31 2006
+
Last update Sun Dec 10 22:56:57 2006
diff -uNr dmd-0.177/dmd/html/d/attribute.html dmd-0.178/dmd/html/d/attribute.html
--- dmd-0.177/dmd/html/d/attribute.html 2006-12-05 18:54:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/attribute.html 2006-12-15 12:19:44.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:29 2006
+
Last update Fri Dec 15 12:19:42 2006
@@ -158,8 +158,9 @@
{ DeclDefs }
- Attributes are a way to modify one or more declarations.
+ Attributes are a way to modify one or more declarations.
The general forms are:
+
attribute declaration; affects the declaration
@@ -177,7 +178,7 @@
}
- For attributes with an optional else clause:
+ For attributes with an optional else clause:
attribute
@@ -213,7 +214,7 @@
Pascal
- D provides an easy way to call C functions and operating
+ 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
extensible by the implementation (they are not keywords).
@@ -222,27 +223,28 @@
C++ is reserved for future use.
Implementation Note:
for Win32 platforms, Windows and Pascal should exist.
-
+
- C function calling conventions are
+ C function calling conventions are
specified by:
+
extern (C):
int foo();
- D conventions are:
+ D conventions are:
extern (D):
- or:
+ or:
extern:
- Windows API conventions are:
+ Windows API conventions are:
extern (Windows):
void *VirtualAlloc(
@@ -257,18 +259,19 @@
AlignAttribute:
align
- align ) Integer )
+ align ( Integer )
- Specifies the alignment of struct members. align by itself
+ 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
which matches the behavior of the companion C compiler when non-default
alignments are used.
-
+
- Matching the behavior of the companion C compiler can have some
+ 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; }
- AlignAttribute is meant for C ABI compatiblity, which is not
+ AlignAttribute is meant for C ABI compatiblity, which is not
the same thing as binary compatibility across diverse platforms.
For that, use packed structs:
+
align (1) struct S
{ byte a;
- A value of 1 means that no alignment is done;
+ A value of 1 means that no alignment is done;
members are packed together.
-
+
- Do not align references or pointers that were allocated
+ Do not align references or pointers that were allocated
using NewExpression on boundaries that are not
- a multipe of 4. The garbage collector assumes that pointers
- and references to gc allocated objects will be on 4
+ a multiple of size_t. The garbage collector assumes that pointers
+ and references to gc allocated objects will be on size_t
byte boundaries. If they are not, undefined behavior will
result.
-
+
- AlignAttribute is ignored when applied to declarations
+ AlignAttribute is ignored when applied to declarations
that are not structs or struct members.
+
- It is often necessary to deprecate a feature in a library,
+ It is often necessary to deprecate a feature in a library,
yet retain it for backwards compatibility. Such
declarations can be marked as deprecated, which means
that the compiler can be set to produce an error
if any code refers to deprecated
declarations:
+
deprecated
{
@@ -318,33 +324,34 @@
}
- Implementation Note: The compiler should have a switch
+ Implementation Note: The compiler should have a switch
specifying if deprecated declarations should be compiled with
out complaint or not.
+
Protection Attribute
- Protection is an attribute that is one of
+ Protection is an attribute that is one of
private, package, protected,
public or export.
-
+
- Private means that only members of the enclosing class can access
+ Private means that only members of the enclosing class can access
the member, or members and functions in the same module as the
enclosing class.
Private members cannot be overridden.
Private module members are equivalent to static declarations
in C programs.
-
+
- Package extends private so that package members can be accessed
+ Package extends private so that package members can be accessed
from code in other modules that are in the same package.
This applies to the innermost package only, if a module is in
nested packages.
-
+
- Protected means that only members of the enclosing class or any
+ Protected means that only members of the enclosing class or any
classes derived from that class,
or members and functions in the same module
as the enclosing class, can access the member.
@@ -353,22 +360,24 @@
that member can only be accessed for the object instance
which is the 'this' object for the member function call.
Protected module members are illegal.
-
+
- Public means that any code within the executable can access the member.
-
+
Public means that any code within the executable can access the member.
+
- Export means that any code outside the executable can access the
+ Export means that any code outside the executable can access the
member. Export
is analogous to exporting definitions from a DLL.
+
const
- The const attribute declares constants that can be
+ The const attribute declares constants that can be
evaluated at compile time. For example:
+
const int foo = 7;
@@ -378,9 +387,10 @@
}
- A const declaration without an initializer must be initialized
+ A const declaration without an initializer must be initialized
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;
@@ -425,10 +435,11 @@
}
- It is not an error to have const module variable declarations without
+ It is not an error to have const module variable declarations without
initializers if there is no constructor. This is to support the practice
of having modules serve only as declarations that are not linked in,
the implementation of it will be in another module that is linked in.
+
@@ -436,12 +447,13 @@
override
- The override attribute applies to virtual functions.
+ 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
is useful for catching errors when a base class's member function
gets its parameters changed, and all derived classes need to have
their overriding functions updated.
+
class Foo
{
@@ -464,11 +476,12 @@
static
- The static attribute applies to functions and data.
+ 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
{
diff -uNr dmd-0.177/dmd/html/d/builtin.html dmd-0.178/dmd/html/d/builtin.html
--- dmd-0.177/dmd/html/d/builtin.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/builtin.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:28 2006
+
Last update Sun Dec 10 22:56:57 2006
@@ -149,21 +149,13 @@
- basic_string
-
- vector
-
- valarray
-
- deque
-
- slice_array
-
- gslice_array
-
- mask_array
-
- indirect_array
-
Fixing the builtin array support means the need for each of these
@@ -176,16 +168,11 @@
This starts with having an array literal, and follows with some
new operators specific to arrays. A library array implementation
has to make due with overloading existing operators.
- The indexing operator, a[i]
-, it shares with C++.
- Added are the array concatenation operator ~
-, array append operator
- ~=
-, array slice operator a[i..j]
-,
+ The indexing operator, a[i], it shares with C++.
+ Added are the array concatenation operator ~, array append operator
+ ~=, array slice operator a[i..j],
and the array vector operator
- a[]
-.
+ a[].
The ~ and ~= concatenation operators resolve a problem that comes
@@ -220,10 +207,8 @@
Associative Arrays
The main benefit for this is, once again, syntactic sugar.
- An associative array keying off of a type T
- and storing an
- int
- value is naturally written
+ An associative array keying off of a type T and storing an
+ int value is naturally written
as:
int[T] foo;
diff -uNr dmd-0.177/dmd/html/d/changelog1.html dmd-0.178/dmd/html/d/changelog1.html
--- dmd-0.177/dmd/html/d/changelog1.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/changelog1.html 2006-12-15 12:19:44.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:28 2006
+
Last update Fri Dec 15 12:19:43 2006
@@ -376,7 +376,7 @@
Download
-
+
D compiler for Win32 and x86 linux
tech support
@@ -387,7 +387,8 @@
@@ -404,7 +405,8 @@
@@ -441,8 +443,7 @@
Fixed D.bugs/5198
Fixed D.bugs/5199
Fixed Linux C ABI compatibility bug with returning structs
- from extern (C)
- functions. this can break
+ from extern (C) functions. this can break
existing code.
@@ -450,7 +451,8 @@
@@ -485,7 +487,8 @@
@@ -519,7 +522,8 @@
@@ -546,7 +550,8 @@
@@ -577,7 +582,8 @@
@@ -609,7 +615,8 @@
@@ -627,7 +634,8 @@
@@ -651,7 +659,8 @@
@@ -705,7 +714,7 @@
Aug 5, 2005
@@ -736,7 +745,7 @@
Jul 10, 2005
@@ -777,7 +786,7 @@
Jun 16, 2005
@@ -806,7 +815,7 @@
Jun 7, 2005
@@ -826,10 +835,8 @@
The IsExpressions are significantly
more general and powerful.
Added VoidInitializers.
- delete aa[key]
- is now deprecated, use
- aa.remove(key)
- instead.
+ delete aa[key] is now deprecated, use
+ aa.remove(key) instead.
Added non-static nested classes.
Added anonymous non-static nested
classes.
@@ -870,7 +877,7 @@
May 20, 2005
@@ -892,7 +899,7 @@
May 19, 2005
@@ -924,7 +931,7 @@
May 11, 2005
@@ -968,7 +975,7 @@
May 3, 2005
@@ -1006,7 +1013,7 @@
Apr 15, 2005
@@ -1071,7 +1078,7 @@
Apr 6, 2005
@@ -1079,8 +1086,7 @@
New/Changed Features
- - In -release
- builds implicit switch defaults,
+
- In -release builds implicit switch defaults,
implicit return statements, and assert(0) expressions are
replaced with HLT instructions.
- Renamed -gt command line switch that invokes the profiler
@@ -1154,7 +1160,7 @@
Mar 18, 2005
@@ -1206,7 +1212,7 @@
Mar 12, 2005
@@ -1221,7 +1227,7 @@
Mar 10, 2005
@@ -1230,11 +1236,9 @@
New/Changed Features
- Added pragma(lib, "library name");
-
- cent and ucent are now keywords, to ensure
they stay reserved.
-
- version=all
- cannot be explicitly set;
+
- version=all cannot be explicitly set;
all is always on anyway.
@@ -1264,7 +1268,8 @@
@@ -1290,9 +1295,7 @@
- If a module statement name is used with a package prefix, as in:
module foo.bar;
- then bar
- is not in scope, one must use foo.bar
-.
+ then bar is not in scope, one must use foo.bar.
Bugs Fixed
@@ -1311,7 +1314,7 @@
Feb 28, 2005
@@ -1325,7 +1328,7 @@
Feb 27, 2005
@@ -1383,7 +1386,7 @@
Feb 12, 2005
@@ -1421,7 +1424,7 @@
Jan 26, 2005
@@ -1440,7 +1443,7 @@
Jan 15, 2005
@@ -1485,7 +1488,7 @@
Dec 30, 2004
@@ -1516,7 +1519,7 @@
Dec 5, 2004
@@ -1542,7 +1545,7 @@
Nov 30, 2004
@@ -1555,7 +1558,7 @@
Nov 29, 2004
@@ -1571,8 +1574,7 @@
for many double lookups.
.offset property is now deprecated, use .offsetof
instead. This makes for better compatibility with C and fewer conflicts
- with offset
- as a field name.
+ with offset as a field name.
Added .ptr property to arrays, which is handier and
more typesafe than casting an array to a pointer.
Added Ben Hinkle's changes to std.stream:
@@ -1610,7 +1612,7 @@
Nov 9, 2004
@@ -1648,7 +1650,7 @@
Oct 28, 2004
@@ -1682,7 +1684,7 @@
Oct 21, 2004
@@ -1693,7 +1695,7 @@
-
+
Oct 20, 2004
@@ -1713,7 +1715,7 @@
-
+
Sep 20, 2004
@@ -1850,7 +1852,6 @@
- One can now 'new' a scalar type, for example:
int* p = new int;
-
Bugs Fixed
@@ -1938,7 +1939,7 @@
Fixed mishandling of out parameters in variadic functions.
Fixed problem of undefined symbols at link time when templates are
expanded in interface declarations.
- Template default arguments for parameters now are 'lazilly'
+ Template default arguments for parameters now are 'lazily'
semantically analyzed, which means they can refer to previous template
argument types.
Fixed DMD GPF when trying to index a mixin with [].
@@ -2183,7 +2184,6 @@
Bugs Fixed
- An error is now issued when the argument to delete
-
is a COM interface object.
- Incorporated Antonio Monteiro's fixes for std.date and std.zip.
- Error now diagnosed when EnumBaseType is not integral.
@@ -2342,11 +2342,8 @@
- Added pragmas.
- Added expression lists to
case statements.
-
- Added goto default;
- and goto case;
- and
+
- Added goto default; and goto case; and
goto case Expression;
-
for use in switch statements.
- Added template alias
parameters.
@@ -2476,13 +2473,11 @@
Bugs Fixed
- Fixed bug with in and out instructions in inline assembler.
-
- Fixed speed problem with %.*s
- printf format.
+
- Fixed speed problem with %.*s printf format.
- Fixed problem with foreach over array of arrays or structs.
- Fixed compiler error with array rehash.
- Now correctly issues error on self-initializations like:
- int a = a;
-
+ int a = a;
- Fixed problem converting "string" to char[], it should be
an exact conversion, not an implicit conversion.
@@ -2643,15 +2638,10 @@
linux version
- - dmd.conf
- now needs to be installed as
- /etc/dmd.conf
-.
-
- phobos.a
- has been renamed as libphobos.a
-
- and been placed in the /usr/lib
- directory.
+
- dmd.conf now needs to be installed as
+ /etc/dmd.conf.
+
- phobos.a has been renamed as libphobos.a
+ and been placed in the /usr/lib directory.
- dmd will now do the link step automatically.
- The bad section name bug is hopefully fixed.
@@ -2797,10 +2787,8 @@
- The argument to a with statement can now be a template instance.
-
- The inline asm for FCOMI/FCOMIP/FUCOMI/FUCOMIP
- can now
- accept the ST,ST(i)
- form of the instruction to match the
+
- The inline asm for FCOMI/FCOMIP/FUCOMI/FUCOMIP can now
+ accept the ST,ST(i) form of the instruction to match the
Intel documentation.
- Fixed numerous minor bugs.
@@ -2826,10 +2814,8 @@
- To convert to type bit now requires an explicit cast,
- rather than implicit. The conversion (cast(bit)i)
- is
- now performed as (i?true:false)
-.
+ rather than implicit. The conversion (cast(bit)i) is
+ now performed as (i?true:false).
- Added library functions string.toString().
@@ -2910,7 +2896,9 @@
-
+
+
+
Oct 1, 2002
@@ -2921,7 +2909,9 @@
-
+
+
+
Sep 28, 2002
diff -uNr dmd-0.177/dmd/html/d/changelog.html dmd-0.178/dmd/html/d/changelog.html
--- dmd-0.177/dmd/html/d/changelog.html 2006-12-09 01:16:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/changelog.html 2006-12-23 20:43:42.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 01:16:27 2006
+
Last update Sat Dec 23 20:43:40 2006
@@ -194,6 +194,8 @@
+ - What's new for D 0.178
+
- What's new for D 0.177
- What's new for D 0.176
@@ -283,6 +285,64 @@
+
+
+
+Dec 23, 2006
+
+New/Changed Features
+
+ - Implemented Named Return Value Optimization
+ - If the first element of an array literal is a static array,
+ it is converted to a dynamic array.
+ - Empty ; no longer allowed after conditional statements,
+ see Bugzilla 576.
+
+
+Bugs Fixed
+
+ - Fixed Bugzilla 39: ArrayMemberInitialization, StructMemberInitializer inconsistencies from dmd's behavior
+ - Fixed Bugzilla 40: DecimalFloat spec doesn't match dmd behavior
+ - Fixed Bugzilla 238: Cannot initialise const field from foreach loop on associative array
+
+ - Fixed Bugzilla 265: Selective import from renamed import behaves strangely
+ - Fixed Bugzilla 576: version.html - ConditionalStatement grammar doesn't make sense
+ - Fixed Bugzilla 577: statement.html - NonEmptyStatement grammar lists DebugStatement and VersionStatement, which are not defined
+ - Fixed Bugzilla 612: Associative arrays ignore opEquals, contrary to the spec
+ - Fixed Bugzilla 630: Obscure, unimplemented features related to in/out contracts
+ - Fixed Bugzilla 631: Spelling errors in DMD distribution
+ - Fixed Bugzilla 634: writef doesn't work on enums
+ - Fixed Bugzilla 635: regression: looping "Error: outer class Outer 'this' needed to 'new' nested class Inner"
+ - Fixed Bugzilla 650: Assertion failure: '0' on line 774 in file 'expression.c'
+ - Fixed Bugzilla 651: Assertion failure: 'global.errors' on line 2622 in file 'template.c'
+ - Fixed Bugzilla 654: Const string member using implicit type inference gives garbage in certain situation
+ - Fixed Bugzilla 661: Error using a zero-init struct's init property
+ - Fixed Bugzilla 663: Slice assignment does not bounds check when it should
+ - Fixed Bugzilla 665: missing functions in std.c.linux.linux
+ - Fixed Bugzilla 667: incorrect value for std.socket.SocketShutdown.BOTH
+ - Fixed Bugzilla 669: (a == b) misuses opCmp and opEquals
+ - Fixed Bugzilla 672: Compiler endless loop with nested class object
+ - Fixed Bugzilla 673: ABI as documented is 32 bit specific.. how about 64 bits?
+ - Fixed Bugzilla 681: Array -- Implicit type doc updates needed
+ - Fixed Bugzilla 682: dmd segfault with vararg template
+ - Fixed Bugzilla 683: New: dmd segv, this ain't the same as bug 682
+ - Fixed Bugzilla 684: dmd should compile this
+ - Fixed Bugzilla 685: dmd assertion failure
+ - Fixed Bugzilla 686: [Regression] opCast of a struct or union is called in nonsensical circumstances
+ - Fixed Bugzilla 687: DDoc doesn't document anonymous enums
+ - Fixed Bugzilla 688: Implicit function template match doesn't work for classes
+ - Fixed D.announce/6072
+
+ - Fixed D/45058 items 1, 2 and 4
+ - Fixed D.bugs/6300: Assertion failure: '0' on line 704 in file 'expression.c'
+ - Fixed c++/5355
+
+
+
+
- Improved the statement grammar thanks to Stewart Gordon.
- Added DMD switch -v1 for D language 1.0 compatibility.
- deprecated === and !== no longer allowed
- - deprecated iftype
- no longer allowed
- - deprecated on_scope_xxxx
- no longer allowed
+ - deprecated iftype no longer allowed
+ - deprecated on_scope_xxxx no longer allowed
- deprecated 'l' numeric literal suffix no longer allowed
- - deprecated if (v; e)
- no longer allowed
- - deprecated instance
- no longer allowed
+ - deprecated if (v; e) no longer allowed
+ - deprecated instance no longer allowed
- scope can now be used for RAII declarations;
use auto for type inference.
@@ -724,8 +780,7 @@
NewExpression.
- Added array literals.
- std.format will now work with struct arguments as long
- as they define a char[] toString()
- member function.
+ as they define a char[] toString() member function.
Bugs Fixed
@@ -1009,8 +1064,7 @@
Bugs Fixed
class Foo
{
@@ -580,10 +578,8 @@
}
- static this()
- is called by the startup code before
- main()
- is called. If it returns normally
+ static this() is called by the startup code before
+ main() is called. If it returns normally
(does not throw an exception), the static destructor is added
to the list of functions to be
called on program termination.
@@ -620,8 +616,7 @@
A static destructor is defined as a special static function with the
- syntax static ~this()
-.
+ syntax static ~this().
class Foo
{
@@ -715,8 +710,7 @@
Invariants contain assert expressions, and so when they fail,
- they throw a AssertError
-s.
+ they throw a AssertErrors.
Class invariants are inherited, that is,
any class invariant is implicitly anded with the invariants of its base
classes.
@@ -754,7 +748,6 @@
cause the unittest test code to be compiled and incorporated into
the resulting executable. The unittest code gets run after
static initialization is run and before the main()
-
function is called.
@@ -802,8 +795,7 @@
set to the size in bytes of the memory to be allocated for the
instance.
The allocator must allocate the memory and return it as a
- void*
-.
+ void*.
If the allocator fails, it must not return a null, but
must throw an exception.
If there is more than one parameter to the allocator, the
@@ -852,8 +844,7 @@
is called a class deallocator.
- The deallocator must have exactly one parameter of type void*
-.
+ The deallocator must have exactly one parameter of type void*.
Only one can be specified for a class.
When a delete expression:
diff -uNr dmd-0.177/dmd/html/d/code_coverage.html dmd-0.178/dmd/html/d/code_coverage.html
--- dmd-0.177/dmd/html/d/code_coverage.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/code_coverage.html 2006-12-10 22:56:58.000000000 +0100
@@ -31,7 +31,7 @@
-
Last update Sat Dec 9 00:40:28 2006
+
Last update Sun Dec 10 22:56:57 2006
@@ -294,8 +294,7 @@
sieve
-The output file will be created called sieve.lst
-, the contents of
+
The output file will be created called sieve.lst, the contents of
which are:
|/* Eratosthenes Sieve prime number calculation. */
@@ -336,13 +335,11 @@
There are 3 lines with an exection count
-of 1, these were each executed once. The declaration line for i, prime
-,
+of 1, these were each executed once. The declaration line for i, prime,
etc., has 5 because there are 5 declarations, and the initialization of
each declaration counts as one statement.
-The first for
- loop shows 22. This is the sum of the 3 parts
+
The first for loop shows 22. This is the sum of the 3 parts
of the for header. If the for header is broken up into 3 lines, the
data is similarly divided:
@@ -353,11 +350,8 @@
which adds up to 22.
-e1&&e2
- and e1||e2
- expressions conditionally
-execute the rvalue e2
-.
+
e1&&e2 and e1||e2 expressions conditionally
+execute the rvalue e2.
Therefore, the rvalue is treated as a separate statement with its own
counter:
@@ -380,11 +374,8 @@
|}
-Similarly, for the e?e1:e2
- expressions, e1
- and
-e2
- are treated as separate statements.
+Similarly, for the e?e1:e2 expressions, e1 and
+e2 are treated as separate statements.
Controlling the Coverage Analyser
diff -uNr dmd-0.177/dmd/html/d/comparison.html dmd-0.178/dmd/html/d/comparison.html
--- dmd-0.177/dmd/html/d/comparison.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/comparison.html 2006-12-10 22:56:58.000000000 +0100
@@ -31,7 +31,7 @@
- Last update Tue Dec 5 18:54:31 2006
+
Last update Sun Dec 10 22:56:57 2006
diff -uNr dmd-0.177/dmd/html/d/cppcomplex.html dmd-0.178/dmd/html/d/cppcomplex.html
--- dmd-0.177/dmd/html/d/cppcomplex.html 2006-12-05 18:54:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/cppcomplex.html 2006-12-10 22:56:56.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:28 2006
+
Last update Sun Dec 10 22:56:54 2006
diff -uNr dmd-0.177/dmd/html/d/cppdbc.html dmd-0.178/dmd/html/d/cppdbc.html
--- dmd-0.177/dmd/html/d/cppdbc.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/cppdbc.html 2006-12-10 22:56:56.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:27 2006
+
Last update Sun Dec 10 22:56:54 2006
@@ -145,27 +145,20 @@
Contract Programming in C++
-The assert
- Macro
+The assert Macro
- C++ does have the basic assert
- macro, which tests its argument
- and if it fails, aborts the program. assert
- can be turned
- on and off with the NDEBUG
- macro.
+ C++ does have the basic assert macro, which tests its argument
+ and if it fails, aborts the program. assert can be turned
+ on and off with the NDEBUG macro.
- assert
- does not know anything about class invariants,
+ assert does not know anything about class invariants,
and does not throw an exception when it fails. It just aborts
- the program after writing a message. assert
- relies on
+ the program after writing a message. assert relies on
a macro text preprocessor to work.
- assert
- is where explicit support for DbC in Standard C++
+ assert is where explicit support for DbC in Standard C++
begins and ends.
Class Invariants
@@ -244,10 +237,8 @@
}
- There's an additional complication with A::foo()
-. Upon every
- normal exit from the function, the invariant()
- should be
+ There's an additional complication with A::foo(). Upon every
+ normal exit from the function, the invariant() should be
called.
This means that code that looks like:
@@ -326,19 +317,14 @@
If the preconditions and postconditions consist of nothing
- more than assert
- macros, the whole doesn't need to
- be wrapped in a #ifdef
- pair, since a good C++ compiler will
- optimize the whole thing away if the assert
-s are turned off.
+ more than assert macros, the whole doesn't need to
+ be wrapped in a #ifdef pair, since a good C++ compiler will
+ optimize the whole thing away if the asserts are turned off.
- But suppose foo()
- sorts an array, and the postcondition needs
+ But suppose foo() sorts an array, and the postcondition needs
to walk the array and verify that it really is sorted. Now
- the shebang needs to be wrapped in #ifdef
-:
+ the shebang needs to be wrapped in #ifdef:
void foo()
{
@@ -353,15 +339,12 @@
(One can make use of the C++ rule that templates are only
- instantiated when used can be used to avoid the #ifdef
-, by
+ instantiated when used can be used to avoid the #ifdef, by
putting the conditions into a template function referenced
- by the assert
-.)
+ by the assert.)
- Let's add a return value to foo()
- that needs to be checked in
+ Let's add a return value to foo() that needs to be checked in
the postconditions. In D:
int foo()
@@ -402,8 +385,7 @@
}
- Now add a couple parameters to foo()
-. In D:
+ Now add a couple parameters to foo(). In D:
int foo(int a, int b)
in { ...preconditions... }
@@ -476,8 +458,7 @@
}
- The semantics for a call to B.foo()
- are:
+ The semantics for a call to B.foo() are:
- Either Apreconditions or Bpreconditions must be satisfied.
@@ -539,20 +520,16 @@
Something interesting has happened here. The preconditions can
- no longer be done using assert
-, since the results need
+ no longer be done using assert, since the results need
to be OR'd together. I'll leave as a reader exercise adding
- in a class invariant, function return values for foo()
-,
+ in a class invariant, function return values for foo(),
and parameters
- for foo()
-.
+ for foo().
Conclusion
These C++ techniques can work up to a point. But, aside from
- assert
-, they are not standardized and so will vary from
+ assert, they are not standardized and so will vary from
project to project. Furthermore, they require much tedious
adhesion to a particular convention, and add significant clutter
to the code. Perhaps that's why it's rarely seen in practice.
diff -uNr dmd-0.177/dmd/html/d/cppstrings.html dmd-0.178/dmd/html/d/cppstrings.html
--- dmd-0.177/dmd/html/d/cppstrings.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/cppstrings.html 2006-12-10 22:56:56.000000000 +0100
@@ -33,7 +33,7 @@
- Last update Sat Dec 9 00:40:26 2006
+
Last update Sun Dec 10 22:56:54 2006
@@ -243,12 +243,9 @@
char[] s1;
foo(s1);
- although for this to work where foo
- expects a 0 terminated
- string, s1
- must have a terminating 0. Alternatively, the
- function std.string.toStringz
- will ensure it:
+ although for this to work where foo expects a 0 terminated
+ string, s1 must have a terminating 0. Alternatively, the
+ function std.string.toStringz will ensure it:
void foo(char*);
char[] s1;
diff -uNr dmd-0.177/dmd/html/d/cpptod.html dmd-0.178/dmd/html/d/cpptod.html
--- dmd-0.177/dmd/html/d/cpptod.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/cpptod.html 2006-12-10 22:56:56.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:26 2006
+
Last update Sun Dec 10 22:56:54 2006
@@ -331,8 +331,7 @@
Sometimes two classes are tightly related but not by inheritance,
but need to access each other's private members. This is done
- using friend
- declarations:
+ using friend declarations:
class A
{
@@ -391,8 +390,7 @@
int abc(A p) { return p.a; }
- The private
- attribute prevents other modules from
+ The private attribute prevents other modules from
accessing the members.
@@ -433,8 +431,7 @@
The compiler automatically interprets all the
<, <=, > and >=
- operators in terms of the cmp
- function, as well
+ operators in terms of the cmp function, as well
as handling the cases where the left operand is not an
object reference.
@@ -503,7 +500,6 @@
of and freeing memory. This is handled automatically in D by
the garbage collector. The second common resources used are semaphores
and locks, handled automatically with D's synchronized
-
declarations and statements.
@@ -828,8 +824,7 @@
This template relies on the
- SFINAE
- (Substitution Failure Is Not An Error) principle.
+ SFINAE principle.
Why it works is a fairly advanced template topic.
The D Way
diff -uNr dmd-0.177/dmd/html/d/ctod.html dmd-0.178/dmd/html/d/ctod.html
--- dmd-0.177/dmd/html/d/ctod.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/ctod.html 2006-12-10 22:56:56.000000000 +0100
@@ -33,7 +33,7 @@
- Last update Sat Dec 9 00:40:26 2006
+
Last update Sun Dec 10 22:56:54 2006
@@ -709,8 +709,7 @@
It's done through a command line switch which affects the entire
program, and woe results if any modules or libraries didn't get
- recompiled. To address this, #pragma
-s are used:
+ recompiled. To address this, #pragmas are used:
#pragma pack(1)
struct ABC
@@ -1074,8 +1073,7 @@
There are 4 names to remember: Handle, HANDLE_INIT,
- struct Handle__, value
-.
+ struct Handle__, value.
The D Way
@@ -1091,8 +1089,7 @@
To handle a default value, add an initializer to the typedef,
- and refer to it with the .init
- property:
+ and refer to it with the .init property:
typedef void* Handle = cast(void*)(-1);
Handle h;
@@ -1101,8 +1098,7 @@
...
- There's only one name to remember: Handle
-.
+ There's only one name to remember: Handle.
@@ -1287,11 +1283,9 @@
To make this work, a helper function membersearchx
-
is needed to recursively
walk the trees. The helper function needs to read and write
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
@@ -1401,10 +1395,7 @@
j = (unsigned)i >> 3;
- If i
- is an int
-, this works fine. But if i
- is
+ If i is an int, this works fine. But if i is
of a type created with typedef,
myint i, j;
@@ -1412,9 +1403,7 @@
j = (unsigned)i >> 3;
- and myint
- happens to be a long int
-, then the cast to
+ and myint happens to be a long int, then the cast to
unsigned
will silently throw away the most significant bits, corrupting
the answer.
@@ -1448,8 +1437,7 @@
A generic context pointer is also needed, represented here by
- void *p
-. The example here is of a trivial container
+ void *p. The example here is of a trivial container
class that holds an array of ints, and a user of that container
that computes the maximum of those ints.
@@ -1565,8 +1553,7 @@
There are two problems with this. The first is that the
- sum
- function needs to know how many arguments were
+ sum function needs to know how many arguments were
supplied. It has to be explicitly written, and it can get
out of sync with respect to the actual number of arguments
written.
diff -uNr dmd-0.177/dmd/html/d/dbc.html dmd-0.178/dmd/html/d/dbc.html
--- dmd-0.177/dmd/html/d/dbc.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/dbc.html 2006-12-15 02:20:44.000000000 +0100
@@ -32,7 +32,7 @@
-
Last update Sat Dec 9 00:40:27 2006
+
Last update Fri Dec 15 02:20:42 2006
@@ -242,57 +242,28 @@
In an out statement, result is initialized and set to the
return value of the function.
-
- The compiler can be adjusted to verify that every in and inout parameter is referenced
- in the in { }
,
- and every out and inout parameter is referenced in the out { }
.
-
- 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
-{
- assert(j == 0);
-}
-out
-{
- assert(j == 10);
-}
-body
-{
- for (i = 0; i < 10; i++)
- j++;
-}
-
- This is not implemented at this time.
In, Out and Inheritance
If a function in a derived class overrides a function in its
super class, then only one of
- the in
- contracts of the function and its base functions
+ the in contracts of the function and its base functions
must be satisfied.
Overriding
functions then becomes a process of loosening the in
-
contracts.
- A function without an in
- contract means that any values
+
A function without an in contract means that any values
of the function parameters are allowed. This implies that if any
- function in an inheritance heirarchy has no in
- contract,
- then in
- contracts on functions overriding it have no useful
+ function in an inheritance hierarchy has no in contract,
+ then in contracts on functions overriding it have no useful
effect.
- Conversely, all of the out
- contracts needs to be satisfied,
+
Conversely, all of the out contracts needs to be satisfied,
so overriding functions becomes a processes of tightening the
out
-
contracts.
diff -uNr dmd-0.177/dmd/html/d/dcompiler.html dmd-0.178/dmd/html/d/dcompiler.html
--- dmd-0.177/dmd/html/d/dcompiler.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/dcompiler.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:28 2006
+
Last update Sun Dec 10 22:56:56 2006
@@ -203,19 +203,15 @@
- \dmd\src\phobos\
-
- D runtime library source
- \dmd\src\dmd\
-
- D compiler front end source under dual (GPL and Artistic) license
- \dmd\html\d\
-
- Documentation
- \dmd\samples\d\
-
- Sample D programs
@@ -228,19 +224,15 @@
- \dmd\bin\dmd.exe
-
- D compiler executable
- \dmd\bin\shell.exe
-
- Simple command line shell
- \dmd\bin\sc.ini
-
- Global compiler settings
- \dmd\lib\phobos.lib
-
- D runtime library
@@ -268,14 +260,10 @@
they are run from a console window.
Switch to the root directory.
Unzip the files in the root directory.
- dmd.zip
- will create
- a \dmd
- directory with all the files in it.
- dmc.zip
- will create
- a \dm
- directory with all the files in it.
+ dmd.zip will create
+ a \dmd directory with all the files in it.
+ dmc.zip will create
+ a \dm directory with all the files in it.
A typical session might look like:
@@ -292,8 +280,7 @@
\dmd\bin\shell all.sh
- in the \dmd\samples\d
- directory for several small examples.
+ in the \dmd\samples\d directory for several small examples.
Compiler Arguments and Switches
@@ -379,7 +366,6 @@
pass linkerflag to the linker, for example,
/ma/li
-
-nofloat
Prevents emission of __fltused reference in
object files, even if floating point code is present.
@@ -497,8 +483,7 @@
conflicting use of environment variables.
- Environment variables follow the [Environment]
- section
+ Environment variables follow the [Environment] section
heading, in NAME=value pairs.
The NAMEs are treated as upper case.
Comments are lines that start with ;.
@@ -535,26 +520,19 @@
- /dmd/bin/dmd
-
- D compiler executable
- /dmd/bin/dumpobj
-
- Elf file dumper
- /dmd/bin/obj2asm
-
- Elf file disassembler
- /dmd/bin/dmd.conf
-
-
- Global compiler settings (copy to /etc/dmd.conf
-)
+
- Global compiler settings (copy to /etc/dmd.conf)
- /dmd/lib/libphobos.a
-
-
- D runtime library (copy to /usr/lib/libphobos.a
-)
+
- D runtime library (copy to /usr/lib/libphobos.a)
@@ -577,18 +555,14 @@
Unzip the archive into your home directory.
It will create
- a ~/dmd
- directory with all the files in it.
+ a ~/dmd directory with all the files in it.
All the tools are command line tools, which means
they are run from a console window.
- Edit the file ~/dmd/bin/dmd.conf
- to put the path in to
+ Edit the file ~/dmd/bin/dmd.conf to put the path in to
where the phobos source files are.
- Copy dmd.conf
- to /etc
-:
+ Copy dmd.conf to /etc:
cp dmd/bin/dmd.conf /etc
@@ -598,14 +572,11 @@
chmod u+x dmd/bin/dmd dmd/bin/obj2asm dmd/bin/dumpobj
- Put dmd/bin
- on your PATH,
+ Put dmd/bin on your PATH,
or copy the linux executables
to /usr/local/bin
-
- Copy the library to /usr/lib
-:
+ Copy the library to /usr/lib:
cp dmd/lib/libphobos.a /usr/lib
@@ -690,7 +661,6 @@
-Llinkerflag
pass linkerflag to the linker, for example,
-M
-
-O
optimize
-o-
@@ -777,8 +747,7 @@
conflicting use of environment variables.
- Environment variables follow the [Environment]
- section
+
Environment variables follow the [Environment] section
heading, in NAME=value pairs.
The NAMEs are treated as upper case.
Comments are lines that start with ;.
@@ -800,7 +769,6 @@
will cause a segment violation.
The configuration file is /etc/dmd.conf
-
diff -uNr dmd-0.177/dmd/html/d/ddoc.html dmd-0.178/dmd/html/d/ddoc.html
--- dmd-0.177/dmd/html/d/ddoc.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/ddoc.html 2006-12-10 22:56:58.000000000 +0100
@@ -31,7 +31,7 @@
- Last update Sat Dec 9 00:40:28 2006
+
Last update Sun Dec 10 22:56:57 2006
@@ -270,7 +270,6 @@
If a documentation comment for a declaration consists only of the
identifier ditto
-
then the documentation comment for the previous declaration at the same
declaration scope is applied to this declaration as well.
@@ -566,10 +565,10 @@
diff -uNr dmd-0.177/dmd/html/d/declaration.html dmd-0.178/dmd/html/d/declaration.html
--- dmd-0.177/dmd/html/d/declaration.html 2006-12-05 18:54:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/declaration.html 2006-12-15 00:15:06.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:29 2006
+
Last update Fri Dec 15 00:15:04 2006
@@ -268,13 +268,16 @@
Initializer:
void
+ NonVoidInitializer
+
+NonVoidInitializer:
AssignExpression
ArrayInitializer
StructInitializer
ArrayInitializer:
- [ ArrayMemberInitializations ]
[ ]
+ [ ArrayMemberInitializations ]
ArrayMemberInitializations:
ArrayMemberInitialization
@@ -282,8 +285,8 @@
ArrayMemberInitialization , ArrayMemberInitializations
ArrayMemberInitialization:
- AssignExpression
- AssignExpression : AssignExpression
+ NonVoidInitializer
+ AssignExpression : NonVoidInitializer
StructInitializer:
{ }
@@ -295,8 +298,8 @@
StructMemberInitializer , StructMemberInitializers
StructMemberInitializer:
- AssignExpression
- Identifier : AssignExpression
+ NonVoidInitializer
+ Identifier : NonVoidInitializer
AutoDeclaration:
StorageClasses Identifier = AssignExpression ;
@@ -359,7 +362,7 @@
If a declaration starts with a StorageClass and has
- an Initializer from which the type can be inferred,
+ a NonVoidInitializer from which the type can be inferred,
the type on the declaration can be omitted.
static x = 3;
- The Initializer cannot contain forward references
+ The NonVoidInitializer cannot contain forward references
(this restriction may be removed in the future).
The implicitly inferred type is statically bound
to the declaration at compile time, not run time.
diff -uNr dmd-0.177/dmd/html/d/dlinks.html dmd-0.178/dmd/html/d/dlinks.html
--- dmd-0.177/dmd/html/d/dlinks.html 2006-12-05 18:54:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/dlinks.html 2006-12-10 22:56:56.000000000 +0100
@@ -31,7 +31,7 @@
- Last update Tue Dec 5 18:54:28 2006
+
Last update Sun Dec 10 22:56:54 2006
diff -uNr dmd-0.177/dmd/html/d/dll.html dmd-0.178/dmd/html/d/dll.html
--- dmd-0.177/dmd/html/d/dll.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/dll.html 2006-12-10 22:56:58.000000000 +0100
@@ -31,7 +31,7 @@
- Last update Sat Dec 9 00:40:27 2006
+
Last update Sun Dec 10 22:56:56 2006
@@ -218,7 +218,6 @@
DLLs can be created in D in roughly the same way as in C.
A DllMain()
-
is required, looking like:
import std.c.windows.windows;
@@ -262,8 +261,7 @@
Notes:
- The _moduleUnitTests() call is optional.
-
- The presence of DllMain()
- is recognized by the compiler
+
- The presence of DllMain() is recognized by the compiler
causing it to emit a reference to
__acrtused_dll
and the phobos.lib runtime library.
@@ -546,8 +544,7 @@
- DllMain
- This is the main entry point for any D DLL. It gets called
by the C startup code
- (for DMC++, the source is \dm\src\win32\dllstart.c
-).
+ (for DMC++, the source is \dm\src\win32\dllstart.c).
The printf's are placed there so one can trace how it gets
called.
Notice that the initialization and termination code seen in
@@ -616,22 +613,16 @@
- To build the mydll.dll
- DLL:
+ To build the mydll.dll DLL:
- - dmd -c mydll -g
-
-
Compiles mydll.d
- into mydll.obj
-.
+ - dmd -c mydll -g
+
Compiles mydll.d into mydll.obj.
-g turns on debug info generation.
-
- dmd mydll.obj \dmd\lib\gcstub.obj mydll.def -g -L/map
-
-
Links mydll.obj
- into a DLL named
+ - dmd mydll.obj \dmd\lib\gcstub.obj mydll.def -g -L/map
+
Links mydll.obj into a DLL named
mydll.dll
@@ -649,13 +640,11 @@
-mydll.dll).
- gcstub.obj
- is not required, but it prevents the bulk
+.
+ gcstub.obj is not required, but it prevents the bulk
of the gc code from being linked in, since it will not be used
anyway. It saves about 12Kb.
- mydll.def
- is the
+ mydll.def is the
Module Definition File,
and has the contents:
@@ -667,27 +656,21 @@
-g turns on debug info generation, and
- -L/map generates a map file mydll.map
-.
+ -L/map generates a map file mydll.map.
-
- implib /noi /system mydll.lib mydll.dll
-
+
- implib /noi /system mydll.lib mydll.dll
Creates an
import library
- mydll.lib
- suitable
+ mydll.lib suitable
for linking in with an application that will be statically
- loading mydll.dll
-.
+ loading mydll.dll.
-
+ )
- Here's test.d
-, a sample application that makes use of
- mydll.dll
-. There are two versions, one statically binds to
+ Here's test.d, a sample application that makes use of
+ mydll.dll. There are two versions, one statically binds to
the DLL, and the other dynamically loads it.
import std.stdio;
@@ -790,21 +773,14 @@
C:>dmd test mydll.lib -g
- Note how it is linked with mydll.lib
-, the import library
- for mydll.dll
-.
- The code is straightforward, it initializes mydll.lib
- with
+ Note how it is linked with mydll.lib, the import library
+ for mydll.dll.
+ The code is straightforward, it initializes mydll.lib with
a call to MyDLL_Initialize(), passing the handle
- to test.exe
-'s gc.
+ to test.exe's gc.
Then, we can use the DLL and call its functions just as if
- it were part of test.exe
-. In foo(), gc memory
- is allocated and freed both by test.exe
- and mydll.dll
-.
+ it were part of test.exe. In foo(), gc memory
+ is allocated and freed both by test.exe and mydll.dll.
When we're done using the DLL, it is terminated with
MyDLL_Terminate().
@@ -828,20 +804,17 @@
C:>dmd test -version=DYNAMIC_LOAD -g
- The import library mydll.lib
- is not needed.
+ The import library mydll.lib is not needed.
The DLL is loaded with a call to
LoadLibraryA(),
and each exported function has to be retrieved via
a call to
GetProcAddress().
An easy way to get the decorated name to pass to GetProcAddress()
- is to copy and paste it from the generated mydll.map
- file
+ is to copy and paste it from the generated mydll.map file
under the Export heading.
Once this is done, we can use the member functions of the
- DLL classes as if they were part of test.exe
-.
+ DLL classes as if they were part of test.exe.
When done, release the DLL with
FreeLibrary().
diff -uNr dmd-0.177/dmd/html/d/download.html dmd-0.178/dmd/html/d/download.html
--- dmd-0.177/dmd/html/d/download.html 2006-12-05 18:54:34.000000000 +0100
+++ dmd-0.178/dmd/html/d/download.html 2006-12-10 22:57:00.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:32 2006
+
Last update Sun Dec 10 22:56:58 2006
diff -uNr dmd-0.177/dmd/html/d/dstyle.html dmd-0.178/dmd/html/d/dstyle.html
--- dmd-0.177/dmd/html/d/dstyle.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/dstyle.html 2006-12-14 17:35:48.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:30 2006
+
Last update Thu Dec 14 17:35:46 2006
@@ -195,9 +195,9 @@
The D Style is a set of style conventions for writing
D programs. The D Style is not enforced by the compiler, it is
purely cosmetic and a matter of choice. Adhering to the D Style,
- however, will make it easier for others to work with your D
- code and easier for you to work with others' D code.
- The D Style can form the starting point for a D project
+ however, will make it easier for others to work with your
+ code and easier for you to work with others' code.
+ The D Style can form the starting point for a project
style guide customized for your project team.
@@ -209,7 +209,8 @@
- One statement per line.
- - Hardware tabs are at 8 column increments.
+ - Hardware tabs are at 8 column increments. Avoid using
+ hardware tabs if they are set at a different value.
- Each indentation level will be four columns.
@@ -227,6 +228,7 @@
statement; statement;
+
Use block comments to document a multiple line block of
statements:
@@ -237,6 +239,7 @@
statement;
statement;
+
Use nesting comments to 'comment out' a piece of trial code:
-
+
Naming Conventions
-
- - General
+
- General
- Names formed by joining multiple words should have each word
other than the first capitalized.
Names shall not begin with an underscore '_'.
@@ -265,8 +267,7 @@
- Module
- Module and package names are all lower case, and only contain
the characters [a..z][0..9][_]. This avoids problems dealing
- with case insensitive file systems.
-
+ with case insensitive file systems.
- C Modules
- Modules that are interfaces to C functions go into the "c"
@@ -274,50 +275,52 @@
import std.c.stdio;
Module names should be all lower case.
-
+
- - Class, Struct, Union, Enum names
+
- Class, Struct, Union, Enum, Template names
- are capitalized.
class Foo;
class FooAndBar;
+
- - Function names
+
- Function names
- Function names are not capitalized.
int done();
int doneProcessing();
+
- - Const names
-
- Are in all caps.
+
- Const names
+ - Are in all caps.
- - Enum member names
-
- Are in all caps.
+
- Enum member names
+ - Are in all caps.
-
+
Meaningless Type Aliases
- Things like:
+ Things like:
alias void VOID;
alias int INT;
alias int* pint;
- should be avoided.
+ should be avoided.
Declaration Style
- Since in D the declarations are left-associative, left justify them:
+ Since the declarations are left-associative, left justify them:
int[] x, y; int** p, q;
- to emphasize their relationship. Do not use the C style:
+ to emphasize their relationship. Do not use the C style:
int []x, y; int **p, q;
-It also neatly solves the problem if ...lots of code...
- goes on at
+
It also neatly solves the problem if ...lots of code... goes on at
some length, and in the future a maintenance programmer inserts a
return statement in it, not realizing that verbose must be reset upon
exit. The reset code is where it belongs conceptually, rather than where
diff -uNr dmd-0.177/dmd/html/d/expression.html dmd-0.178/dmd/html/d/expression.html
--- dmd-0.177/dmd/html/d/expression.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/expression.html 2006-12-14 21:31:36.000000000 +0100
@@ -31,7 +31,7 @@
-
Last update Sat Dec 9 00:40:27 2006
+
Last update Thu Dec 14 21:31:35 2006
@@ -363,13 +363,9 @@
For class and struct objects, the expression (a == b)
-
is rewritten as
- a.opEquals(b)
-, and (a != b)
- is rewritten as
- !a.opEquals(b)
-.
+ a.opEquals(b), and (a != b) is rewritten as
+ !a.opEquals(b).
For static and dynamic arrays, equality is defined as the
@@ -384,8 +380,7 @@
The is compares for identity.
- To compare for not identity, use e1 !is e2
-.
+ To compare for not identity, use e1 !is e2.
The type of the result is bool. The operands
go through the usual conversions to bring them to a common type before
comparison.
@@ -851,10 +846,8 @@
}
-
In order to determine if an object o
- is an instance of
- a class B
- use a cast:
+
In order to determine if an object o is an instance of
+ a class B use a cast:
if (cast(B) o)
@@ -1040,8 +1033,7 @@
Within a non-static member function, super resolves to
a reference to the object that called the function, cast to
its base class. It is an error if there is no base class.
- (Only class Object
- has no base class.)
+ (Only class Object has no base class.)
super is not allowed in struct member
functions.
If a member function is called with an explicit reference
@@ -1089,6 +1081,8 @@
The type of the first element is taken to be the type of
all the elements, and all elements are implicitly converted
to that type.
+ If that type is a static array, it is converted to a dynamic
+ array.
[1,2,3]; }
- Nested functions can be accessed only if the name is in scope.
+ Nested functions can be accessed only if the name is in scope.
+
void foo()
{
void A()
@@ -905,7 +884,7 @@
}
- and:
+ and:
int bar(int a)
{
@@ -921,9 +900,10 @@
}
- Nested functions have access to the variables and other symbols
+ Nested functions have access to the variables and other symbols
defined by the lexically enclosing function.
This access includes both the ability to read and write them.
+
int bar(int a)
{ int c = 3;
@@ -945,7 +925,7 @@
}
- This access can span multiple nesting levels:
+ This access can span multiple nesting levels:
int bar(int a)
{ int c = 3;
@@ -962,9 +942,10 @@
}
- Static nested functions cannot access any stack variables of
+ Static nested functions cannot access any stack variables of
any lexically enclosing function, but can access static variables.
This is analogous to how static member functions behave.
+
int bar(int a)
{ int c;
@@ -980,7 +961,7 @@
}
- Functions can be nested within member functions:
+ Functions can be nested within member functions:
struct Foo
{ int a;
@@ -997,9 +978,10 @@
}
- Member functions of nested classes and structs do not have
+ Member functions of nested classes and structs do not have
access to the stack variables of the enclosing function, but
do have access to the other symbols:
+
void test()
{ int j;
@@ -1027,12 +1009,13 @@
}
- Nested functions always have the D function linkage type.
-
+
Nested functions always have the D function linkage type.
+
- Unlike module level declarations, declarations within function
+ Unlike module level declarations, declarations within function
scope are processed in order. This means that two nested functions
cannot mutually call each other:
+
void test()
{
@@ -1041,7 +1024,7 @@
}
- The solution is to use a delegate:
+ The solution is to use a delegate:
void test()
{
@@ -1052,12 +1035,12 @@
}
- Future directions: This restriction may be removed.
+ Future directions: This restriction may be removed.
-Delegates, Function Pointers, and Dynamic Closures
+
- A function pointer can point to a static nested function:
+ A function pointer can point to a static nested function:
int function() fp;
@@ -1075,7 +1058,7 @@
}
- A delegate can be set to a non-static nested function:
+ A delegate can be set to a non-static nested function:
int delegate() dg;
@@ -1088,9 +1071,10 @@
}
- The stack variables, however, are not valid once the function
+ The stack variables, however, are not valid once the function
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;
@@ -1100,7 +1084,7 @@
}
- Delegates to non-static nested functions contain two pieces of
+ Delegates to non-static nested functions contain two pieces of
data: the pointer to the stack frame of the lexically enclosing
function (called the frame pointer) and the address of the
function. This is analogous to struct/class non-static member
@@ -1108,6 +1092,7 @@
the address of the member function.
Both forms of delegates are interchangeable, and are actually
the same type:
+
struct Foo
{ int a = 7;
@@ -1136,8 +1121,7 @@
The .ptr property of a delegate will return the
- frame pointer value as a void*
-.
+ frame pointer value as a void*.
The .funcptr property of a delegate will return the
@@ -1150,18 +1134,17 @@
Anonymous Functions and Anonymous Delegates
- See Function Literals.
-
+ See Function Literals.
+
main() Function
- For console programs, main()
- serves as the entry point.
+ For console programs, main() serves as the entry point.
It gets called after all the module initializers are run, and
after any unittests are run.
After it returns, all the module destructors are run.
- main()
- must be declared using one of the following forms:
+ main() must be declared using one of the following forms:
+
void main() { ... }
void main(char[][] args) { ... }
@@ -1169,7 +1152,25 @@
int main(char[][] args) { ... }
-)
+
+
+
+
+
+
+
+
+
+
+
diff -uNr dmd-0.177/dmd/html/d/future.html dmd-0.178/dmd/html/d/future.html
--- dmd-0.177/dmd/html/d/future.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/future.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:30 2006
+
Last update Sun Dec 10 22:56:56 2006
diff -uNr dmd-0.177/dmd/html/d/garbage.html dmd-0.178/dmd/html/d/garbage.html
--- dmd-0.177/dmd/html/d/garbage.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/garbage.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:27 2006
+
Last update Sun Dec 10 22:56:56 2006
@@ -332,8 +332,7 @@
A copying garbage collector may change this value.
-
Do not store magic values into pointers, other than null
-.
+ Do not store magic values into pointers, other than null.
Do not write pointer values out to disk and read them back in
@@ -383,13 +382,11 @@
This may result in intermediate conditions where there is
not a valid pointer, and if the gc pauses the thread in such a
condition, it can corrupt memory.
- Most implementations of memcpy()
- will work since the
+ Most implementations of memcpy() will work since the
internal implementation of it does the copy in aligned chunks
greater than or equal to a pointer size, but since this kind of
implementation is not guaranteed by the C standard, use
- memcpy()
- only with extreme caution.
+ memcpy() only with extreme caution.
diff -uNr dmd-0.177/dmd/html/d/glossary.html dmd-0.178/dmd/html/d/glossary.html
--- dmd-0.177/dmd/html/d/glossary.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/glossary.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:30 2006
+
Last update Sun Dec 10 22:56:56 2006
@@ -193,52 +193,138 @@
Glossary
-
- - COW (Copy On Write)
-
- COW is a memory allocation strategy where arrays are copied
+
- COW (Copy On Write)
+ - COW is a memory allocation strategy where arrays are copied
if they are to be modified.
-
+
- - GC (Garbage Collection)
-
- Garbage collection is the common name for the more highbrow
+
- GC (Garbage Collection)
+ - Garbage collection is the common name for the
term automatic memory management. Memory can be allocated and used,
and the GC will automatically free any chunks of memory no longer
- referred to. In contrast, C and C++ use explicit memory management
- where the programmer must carefully match up each allocation with
+ referred to. In contrast, explicit memory management
+ is where the programmer must carefully match up each allocation with
one and only one free.
-
+
- - Illegal
-
- A code construct is illegal if it does not conform to the
+
- Illegal
+ - A code construct is illegal if it does not conform to the
D language specification.
This may be true even if the compiler or runtime fails to detect
the error.
-
+
- - Implementation Defined Behavior
-
- This is variation in behavior of the D language in a manner
+
- Implementation Defined Behavior
+ - This is variation in behavior of the D language in a manner
that is up to the implementor of the language.
An example of implementation defined behavior would be the size in
bytes of a pointer: on a 32 bit machine it would be 4 bytes, on
a 64 bit machine it would be 8 bytes.
Minimizing implementation defined behavior in the language will
maximize the portability of code.
-
+
+
+ - NRVO (Named Return Value Optimization)
+ -
NRVO is a technique invented by Walter Bright around
+ 1991 (the term for it was coined later) to minimize copying of struct
+ data.
+ Functions normally return their function return values in
+ registers. For structs, however, they often are too big to
+ fit in registers. The usual solution to this is to pass to
+ the function a hidden pointer to a struct instance in the
+ caller's stack frame, and the return value is copied there.
+ For example:
+
+struct S { int a, b, c, d; }
+
+S foo()
+{
+ S result;
+ result.a = 3;
+ return result;
+}
+
+void test()
+{
+ S s = foo();
+}
+
+
+ is rewritten as:
+
+S* foo(S* hidden)
+{
+ S result;
+ result.a = 3;
+ *hidden = result;
+ return hidden;
+}
+
+void test()
+{
+ S tmp;
+ S s = *foo(&tmp);
+}
+
+ This rewrite gives us an extra temporaty object tmp,
+ and copies the struct contents twice.
+ What NRVO does is recognize that the sole purpose of result
+ is to provide a return value, and so all references to result
+ can be replaced with *hidden.
+ foo is then rewritten as:
+
+S* foo(S* hidden)
+{
+ hidden.a = 3;
+ return hidden;
+}
+
+ A further optimization is done on the call to foo to eliminate
+ the other copy, giving:
+void test()
+{
+ S s;
+ foo(&s);
+}
+
+ The result is written directly into the destination s,
+ instead of passing through two other instances.
+
+
+ - POD (Plain Old Data)
+ - Refers to a struct that contains no hidden members,
+ does not have virtual functions, does not inherit,
+ has no destructor,
+ and can be initialized and copied via simple bit copies.
+ D structs are POD.
+
- - RAII (Resource Acquisition Is Initialization)
-
- RAII refers to the technique of having the destructor
+
- RAII (Resource Acquisition Is Initialization)
+ - RAII refers to the technique of having the destructor
of a class object called when the object goes out of scope.
The destructor then releases any resources acquired by
that object.
RAII is commonly used for resources that are in short supply
or that must have a predictable point when they are released.
-
+ RAII objects in D are created using the scope storage class.
+
+
+ - SFINAE (Substitution Failure Is Not An Error)
+ - If template argument deduction results in a type
+ that is not valid, that specialization of the template
+ is not considered further. It is not a compile error.
+ See also SFINAE.
+
+
+ - TMP (Template Metaprogramming)
+ - TMP is using the template features of the language to
+ execute programs at compile time rather than runtime.
- - Undefined Behavior
-
- Undefined behavior happens when an illegal code construct is
+
- UB (Undefined Behavior)
+ - Undefined behavior happens when an illegal code construct is
executed. Undefined behavior can include random, erratic results,
crashes, faulting, etc.
-
+
diff -uNr dmd-0.177/dmd/html/d/html.html dmd-0.178/dmd/html/d/html.html
--- dmd-0.177/dmd/html/d/html.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/html.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:30 2006
+
Last update Sun Dec 10 22:56:56 2006
diff -uNr dmd-0.177/dmd/html/d/htod.html dmd-0.178/dmd/html/d/htod.html
--- dmd-0.177/dmd/html/d/htod.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/htod.html 2006-12-10 22:56:58.000000000 +0100
@@ -31,7 +31,7 @@
- Last update Sat Dec 9 00:40:28 2006
+
Last update Sun Dec 10 22:56:57 2006
@@ -238,8 +238,7 @@
-hc
By default, htod will insert the C and C++ declarations
-in a file into the output file prefixed by //C
-.
+in a file into the output file prefixed by //C .
-hc will suppress this.
Use only if you're confident that htod is generating the
correct output file (such as if the header file was modified with
@@ -248,15 +247,13 @@
-hi
-By default, htod will represent a #include "file"
- with
+By default, htod will represent a #include "file" with
a corresponding import statement. The -hi will cause the
declarations in the included file to be converted to D declarations as
well. The declarations in all included files are parsed regardless.
-hi is handy when replacing an entire hierarchy of include files
with a single D import.
-System includes like #include <file>
- are not affected
+System includes like #include <file> are not affected
by -hi.
See also -hs.
@@ -311,8 +308,7 @@
void bar(int x, int y, long z);
-The C declarations are prefixed by the string "//C "
-.
+The C declarations are prefixed by the string "//C ".
Type Mappings
diff -uNr dmd-0.177/dmd/html/d/htomodule.html dmd-0.178/dmd/html/d/htomodule.html
--- dmd-0.177/dmd/html/d/htomodule.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/htomodule.html 2006-12-10 22:56:58.000000000 +0100
@@ -31,7 +31,7 @@
- Last update Sat Dec 9 00:40:27 2006
+
Last update Sun Dec 10 22:56:56 2006
@@ -189,28 +189,22 @@
-
Converting C .h
- Files to D Modules
+
Converting C .h Files to D Modules
While D cannot directly compile C source code, it can easily
interface to C code, be linked with C object files, and call
C functions in DLLs.
- The interface to C code is normally found in C
.h
- files.
+ The interface to C code is normally found in C
.h files.
So, the trick to connecting with C code is in converting C
-
.h
- files to D modules.
+
.h files to D modules.
This turns out to be difficult to do mechanically since
inevitably some human judgement must be applied.
This is a guide to doing such conversions.
Preprocessor
-
.h
- files can sometimes be a bewildering morass of layers of
- macros,
#include
- files,
#ifdef
-'s, etc. D doesn't
+
.h files can sometimes be a bewildering morass of layers of
+ macros,
#include files,
#ifdef's, etc. D doesn't
include a text preprocessor like the C preprocessor,
so the first step is to remove the need for
it by taking the preprocessed output. For DMC (the Digital
@@ -219,15 +213,11 @@
dmc -c program.h -e -l
- will create a file
program.lst
- which is the source file after
+ will create a file
program.lst which is the source file after
all text preprocessing.
- Remove all the #if
-, #ifdef
-, #include
-,
+ Remove all the #if, #ifdef, #include,
etc. statements.
Linkage
@@ -296,18 +286,13 @@
NULL
-
NULL
- and
((void*)0)
- should be replaced
- with
null
-.
+
NULL and
((void*)0) should be replaced
+ with
null.
Numeric Literals
Any 'L' or 'l' numeric literal suffixes should be removed,
- as a C
long
- is (usually) the same size as a D
int
-.
+ as a C
long is (usually) the same size as a D
int.
Similarly, 'LL' suffixes should be replaced with a
single 'L'.
Any 'u' suffix will work the same in D.
@@ -434,10 +419,8 @@
Const Type Modifiers
- D has
const
- as a storage class, not a type modifier. Hence, just
- drop any
const
- used as a type modifier:
+ D has
const as a storage class, not a type modifier. Hence, just
+ drop any
const used as a type modifier:
void foo(const int *p, char *const q);
@@ -454,38 +437,31 @@
there will be a multiple definition error. To fix this problem,
the idea is to declare the variable in a D module, but not link
in that module. For example, given a C header file named
-
foo.h
-:
+
foo.h:
struct Foo { };
struct Foo bar;
- It can be replaced with two D modules,
foo.d
-:
+ It can be replaced with two D modules,
foo.d:
struct Foo { }
import fooextern;
- and
fooextern.d
-:
+ and
fooextern.d:
Foo bar;
- The
foo.obj
- file is linked in, and
fooextern.obj
-
+ The
foo.obj file is linked in, and
fooextern.obj
is not. While this is not the most elegant looking method, it does
work, and since it is pretty rare in C libraries to use global
variables in its interface, it isn't an issue in practice.
Typedef
-
alias
- is the D equivalent to the C
typedef
-:
+
alias is the D equivalent to the C
typedef:
typedef int foo;
@@ -518,11 +494,8 @@
A good D implementation by default will align struct members the
same way as the C compiler it was designed to work with. But
- if the
.h
- file has some
#pragma
-'s to control alignment, they
- can be duplicated with the D
align
- attribute:
+ if the
.h file has some
#pragma's to control alignment, they
+ can be duplicated with the D
align attribute:
#pragma pack(1)
struct Foo
@@ -586,10 +559,7 @@
}
-
__cdecl
-, __pascal
-, __stdcall
-
+
__cdecl, __pascal, __stdcall
int __cdecl x;
int __cdecl foo(int a);
@@ -605,8 +575,7 @@
extern (Windows) int abc(int c);
-
__declspec(dllimport)
-
+
__declspec(dllimport)
__declspec(dllimport) int __stdcall foo(int a);
@@ -616,11 +585,9 @@
export extern (Windows) int foo(int a);
-
__fastcall
-
+
__fastcall
- Unfortunately, D doesn't support the
__fastcall
- convention.
+ Unfortunately, D doesn't support the
__fastcall convention.
Therefore, a shim will be needed, either written in C:
int __fastcall foo(int a);
@@ -631,12 +598,10 @@
}
- and compiled with a C compiler that supports
__fastcall
- and
+ and compiled with a C compiler that supports
__fastcall and
linked in, or compile the above, disassemble it with
obj2asm
- and insert it in a D
myfoo
- shim with
+ and insert it in a D
myfoo shim with
inline assembler.
diff -uNr dmd-0.177/dmd/html/d/iasm.html dmd-0.178/dmd/html/d/iasm.html
--- dmd-0.177/dmd/html/d/iasm.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/iasm.html 2006-12-14 17:41:50.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:30 2006
+
Last update Thu Dec 14 17:41:48 2006
@@ -134,19 +134,22 @@
- D, being a systems programming language, provides an inline assembler.
+ D, being a systems programming language, provides an inline
+ assembler.
The inline assembler is standardized for D implementations across
the same CPU family, for example, the Intel Pentium inline assembler
for a Win32 D compiler will be syntax compatible with the inline
assembler for Linux running on an Intel Pentium.
-
+
- Differing D implementations, however, are free to innovate upon
+ Differing D implementations, however, are free to innovate upon
the memory model, function call/return conventions, argument
passing conventions, etc.
-
+
- This document describes the x86 implementation of the inline assembler.
+ This document describes the x86 implementation of the inline
+ assembler.
+
AsmInstruction:
Identifier : AsmInstruction
@@ -170,9 +173,10 @@
Labels
- Assembler instructions can be labeled just like other statements.
+ Assembler instructions can be labeled just like other statements.
They can be the target of goto statements.
For example:
+
void *pc;
asm
@@ -186,26 +190,29 @@
align IntegerExpression
- Causes the assembler to emit NOP instructions to align the next
+ Causes the assembler to emit NOP instructions to align the next
assembler instruction on an IntegerExpression boundary.
IntegerExpression must evaluate to an integer that is
a power of 2.
-
+
- Aligning the start of a loop body can sometimes have a dramatic
+ Aligning the start of a loop body can sometimes have a dramatic
effect on the execution speed.
+
even
- Causes the assembler to emit NOP instructions to align the next
+ Causes the assembler to emit NOP instructions to align the next
assembler instruction on an even boundary.
+
naked
- Causes the compiler to not generate the function prolog and epilog
+ Causes the compiler to not generate the function prolog and epilog
sequences. This means such is the responsibility of inline
assembly programmer, and is normally used when the entire function
is to be written in assembler.
+
db, ds, di, dl, df, dd, de
@@ -270,10 +277,9 @@
Special Cases
-
-
+
- lock, rep, repe, repne,
- repnz, repz
+ repnz, repz
- These prefix instructions do not appear in the same statement
as the instructions they prefix; they appear in their own statement.
For example:
@@ -284,8 +290,9 @@
movsb ;
}
+
- - pause
+
- pause
- This opcode is not supported by the assembler, instead use
{
@@ -295,8 +302,9 @@
which produces the same result.
+
- - floating point ops
+
- floating point ops
- Use the two operand form of the instruction format;
fdiv ST(1); fdiv ST,ST(1); fmul ST,ST(0);
-
-
+
+
Operands
diff -uNr dmd-0.177/dmd/html/d/index.html dmd-0.178/dmd/html/d/index.html
--- dmd-0.177/dmd/html/d/index.html 2006-12-05 18:54:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/index.html 2006-12-10 22:56:56.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:28 2006
+
Last update Sun Dec 10 22:56:54 2006
diff -uNr dmd-0.177/dmd/html/d/interface.html dmd-0.178/dmd/html/d/interface.html
--- dmd-0.177/dmd/html/d/interface.html 2006-12-09 00:41:36.000000000 +0100
+++ dmd-0.178/dmd/html/d/interface.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:41:34 2006
+
Last update Sun Dec 10 22:56:56 2006
@@ -283,17 +283,14 @@
A COM interface is defined as one that derives from the interface
- std.c.windows.com.IUnknown
-. A COM interface differs from
+ std.c.windows.com.IUnknown. A COM interface differs from
a regular D interface in that:
-
- It derives from the interface std.c.windows.com.IUnknown
-.
+ - It derives from the interface std.c.windows.com.IUnknown.
- It cannot be the argument of a DeleteExpression.
- References cannot be upcast to the enclosing class object, nor
can they be downcast to a derived interface. To accomplish this,
- an appropriate QueryInterface()
- would have to be implemented
+ an appropriate QueryInterface() would have to be implemented
for that interface in standard COM fashion.
diff -uNr dmd-0.177/dmd/html/d/interfaceToC.html dmd-0.178/dmd/html/d/interfaceToC.html
--- dmd-0.177/dmd/html/d/interfaceToC.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/interfaceToC.html 2006-12-10 22:56:58.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:28 2006
+
Last update Sun Dec 10 22:56:57 2006
@@ -173,8 +173,7 @@
There are no __cdecl, __far, __stdcall, __declspec, or other
such C type modifiers in D. These are handled by attributes, such
- as extern (C)
-.
+ as extern (C).
There are no const or volatile type modifiers in D. To declare
a C function that uses those type modifiers, just drop those
@@ -435,8 +434,7 @@
Although printf is designed to handle 0 terminated strings,
not D dynamic arrays of chars, it turns out that since D
dynamic arrays are a length followed by a pointer to the data,
- the %.*s
- format works perfectly:
+ the %.*s format works perfectly:
void foo(char[] string)
{
@@ -451,8 +449,7 @@
An improved D function for formatted output is
- std.stdio.writef()
-.
+ std.stdio.writef().
Structs and Unions
diff -uNr dmd-0.177/dmd/html/d/intro.html dmd-0.178/dmd/html/d/intro.html
--- dmd-0.177/dmd/html/d/intro.html 2006-12-05 18:54:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/intro.html 2006-12-10 22:56:56.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:28 2006
+
Last update Sun Dec 10 22:56:54 2006
diff -uNr dmd-0.177/dmd/html/d/lazy-evaluation.html dmd-0.178/dmd/html/d/lazy-evaluation.html
--- dmd-0.177/dmd/html/d/lazy-evaluation.html 2006-12-09 00:40:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/lazy-evaluation.html 2006-12-10 22:57:00.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:28 2006
+
Last update Sun Dec 10 22:56:58 2006
@@ -210,13 +210,10 @@
}
-The second expression p[0]
- is not evaluated unless p
-
+
The second expression p[0] is not evaluated unless p
is not null.
If the second expression was not lazily evaluated, it would
-generate a runtime fault if p
- was null.
+generate a runtime fault if p was null.
While invaluable, the lazy evaluation operators have significant
@@ -267,8 +264,7 @@
but that just papers over the problem. Preprocessor macros have
well known shortcomings:
-- The logging
- variable is exposed in the user's namespace.
+- The logging variable is exposed in the user's namespace.
- Macros are invisible to symbolic debuggers.
- Macros are global only, and cannot be scoped.
- Macros cannot be class members.
@@ -295,18 +291,15 @@
Now, the string building expression only gets evaluated if logging
is true, and encapsulation is maintained. The only trouble is that
-few are going to want to wrap expressions with { return exp; }
-.
+few are going to want to wrap expressions with { return exp; }.
So D takes it one small, but crucial, step further
(suggested by Andrei Alexandrescu).
Any expression
-can be implicitly converted to a delegate that returns either void
- or
+can be implicitly converted to a delegate that returns either void or
the type of the expression.
-The delegate declaration is replaced by the lazy
- storage class
+The delegate declaration is replaced by the lazy storage class
(suggested by Tomasz Stachowiak).
The functions then become:
diff -uNr dmd-0.177/dmd/html/d/lex.html dmd-0.178/dmd/html/d/lex.html
--- dmd-0.177/dmd/html/d/lex.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/lex.html 2006-12-15 12:19:44.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Sat Dec 9 00:40:27 2006
+
Last update Fri Dec 15 12:19:42 2006
@@ -335,11 +335,8 @@
Comments cannot be used as token concatenators, for example,
- abc/**/def
is two tokens, abc
- and def
-,
- not one abcdef
- token.
+ abc/**/def
is two tokens, abc and def,
+ not one abcdef token.
@@ -863,8 +860,8 @@
DecimalDigits .
DecimalDigits . DecimalDigits
DecimalDigits . DecimalDigits DecimalExponent
- . DecimalDigits
- . DecimalDigits DecimalExponent
+ . Decimal
+ . Decimal DecimalExponent
DecimalDigits DecimalExponent
DecimalExponent
@@ -1111,8 +1108,7 @@
parsing.
- There is currently only one special token sequence, #line
-.
+ There is currently only one special token sequence, #line.
SpecialTokenSequence
# line Integer EndOfLine
diff -uNr dmd-0.177/dmd/html/d/lisp-java-d.html dmd-0.178/dmd/html/d/lisp-java-d.html
--- dmd-0.177/dmd/html/d/lisp-java-d.html 2006-12-05 18:54:34.000000000 +0100
+++ dmd-0.178/dmd/html/d/lisp-java-d.html 2006-12-10 22:57:00.000000000 +0100
@@ -31,7 +31,7 @@
- Last update Tue Dec 5 18:54:32 2006
+
Last update Sun Dec 10 22:56:58 2006
@@ -130,21 +130,13 @@
What made implementing this task so easy in D? I just happened to have every
construct I needed at hand. Some of the goodies used, are:
- -
- Assertions, contracts and unittests
-
-
- Built-in arrays and strings, with easy slicing
-
-
- Built-in associative array
-
-
- Garbage collection
-
-
- Type deduction and foreach
-
-
- Nested functions
-
-
- Returning (reference to) a array from a function
-
+ - Assertions, contracts and unittests
+ - Built-in arrays and strings, with easy slicing
+ - Built-in associative array
+ - Garbage collection
+ - Type deduction and foreach
+ - Nested functions
+ - Returning (reference to) a array from a function
During the actual programming I did not have to stop and think about anything.
The program evolved automatically, once I thought of the actual container for
diff -uNr dmd-0.177/dmd/html/d/memory.html dmd-0.178/dmd/html/d/memory.html
--- dmd-0.177/dmd/html/d/memory.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/memory.html 2006-12-10 23:09:40.000000000 +0100
@@ -32,7 +32,7 @@
-
Last update Sat Dec 9 00:40:27 2006
+
Last update Sun Dec 10 23:09:39 2006
@@ -200,32 +200,30 @@
The three primary methods for allocating memory in D are:
-
- - Static data, allocated in the default data segment.
-
- Stack data, allocated on the CPU program stack.
-
- Garbage collected data,
+
- Static data, allocated in the default data segment.
+ - Stack data, allocated on the CPU program stack.
+ - Garbage collected data,
allocated dynamically on the
- garbage collection heap.
+ garbage collection heap.
The techniques for using them, as well
as some advanced alternatives are:
-
- - Strings (and Array) Copy-on-Write
-
- Real Time
-
- Smooth Operation
-
- Free Lists
-
- Reference Counting
-
- Explicit Class Instance Allocation
-
- Mark/Release
-
- RAII (Resource Acquisition Is Initialization)
-
- Allocating Class Instances On The Stack
-
- Allocating Uninitialized Arrays On The Stack
+
-
+
Consider the case of passing an array to a function, possibly
modifying the contents of the array, and returning the modified
@@ -315,20 +313,20 @@
There are several techniques to eliminate or mitigate the effect:
-
- Preallocate all data needed before the part of the code
- that needs to be smooth is run.
+
- Preallocate all data needed before the part of the code
+ that needs to be smooth is run.
- - Manually run a GC collection cycle at points in program
+
- Manually run a GC collection cycle at points in program
execution where it is already paused. An example of such a place
would be where the program has just displayed a prompt for user
input and the user has not responded yet.
This reduces the odds that a collection cycle will be needed
- during the smooth code.
+ during the smooth code.
- - Call std.gc.disable() before the smooth code is run, and
+
- Call std.gc.disable() before the smooth code is run, and
std.gc.enable() afterwards. This will cause the GC to favor allocating
- more memory instead of running a collection pass.
-
+ more memory instead of running a collection pass.
+
@@ -374,17 +372,17 @@
Such free list approaches can be very high performance.
- - If used by multiple threads, the allocate() and
- deallocate() functions need to be synchronized.
+
- If used by multiple threads, the allocate() and
+ deallocate() functions need to be synchronized.
- - The Foo constructor is not re-run by allocate() when
+
- The Foo constructor is not re-run by allocate() when
allocating from the free list, so the allocator may need
- to reinitialize some of the members.
+ to reinitialize some of the members.
- - It is not necessary to practice RAII with this, since
+
- It is not necessary to practice RAII with this, since
if any objects are not passed to deallocate() when done, because
of a thrown exception, they'll eventually get picked up by
- the GC anyway.
+ the GC anyway.
@@ -411,9 +409,7 @@
to run. For specialized purposes, this can be handled by
creating NewDeclarations and DeleteDeclarations.
For example, to allocate using the C runtime library's
- malloc
- and free
-:
+ malloc and free:
import std.c.stdlib;
import std.outofmemory;
@@ -445,52 +441,52 @@
The critical features of new() are:
- - new() does not have a return type specified,
+
- new() does not have a return type specified,
but it is defined to be void*. new() must return
- a void*.
+ a void*.
- - If new() cannot allocate memory, it must
- not return null, but must throw an exception.
+
- If new() cannot allocate memory, it must
+ not return null, but must throw an exception.
- - The pointer returned from new() must be to memory
+
- The pointer returned from new() must be to memory
aligned to the default alignment. This is 8 on win32
- systems.
+ systems.
- - The size parameter is needed in case the
+
- The size parameter is needed in case the
allocator is called from a class derived from Foo and is
- a larger size than Foo.
+ a larger size than Foo.
- - A null is not returned if storage cannot be allocated.
+
- A null is not returned if storage cannot be allocated.
Instead, an exception is thrown. Which exception gets thrown
- is up to the programmer, in this case, OutOfMemory() is.
+ is up to the programmer, in this case, OutOfMemory() is.
- - When scanning memory for root pointers into the garbage
+
- When scanning memory for root pointers into the garbage
collected heap, the static data segment and the stack are
scanned automatically. The C heap is not. Therefore, if Foo
or any class derived from Foo using the allocator contains
any references to data allocated by the garbage collector, the
GC needs to be notified. This is done with the std.gc.addRange()
- method.
+ method.
- - No initialization of the memory is necessary, as code
+
- No initialization of the memory is necessary, as code
is automatically inserted after the call to new() to set the
class instance members to their defaults and then the constructor
- (if any) is run.
+ (if any) is run.
The critical features of delete() are:
- - The destructor (if any) has already been called on the
+
- The destructor (if any) has already been called on the
argument p, so the data it points to should be assumed to
- be garbage.
+ be garbage.
- - The pointer p may be null.
+
- The pointer p may be null.
- - If the GC was notified with std.gc.addRange(), a corresponding
- call to std.gc.removeRange() must happen in the deallocator.
+
- If the GC was notified with std.gc.addRange(), a corresponding
+ call to std.gc.removeRange() must happen in the deallocator.
- - If there is a delete(), there should be a corresponding new().
+
- If there is a delete(), there should be a corresponding new().
If memory is allocated using class specific allocators and deallocators,
@@ -575,9 +571,9 @@
}
-
- The allocation of buffer[] itself is added as
+
The allocation of buffer[] itself is added as
a region to the GC, so there is no need for a separate
- call inside Foo.new() to do it.
+ call inside Foo.new() to do it.
@@ -642,27 +638,27 @@
- - The uninitialized data that is on the stack will get scanned by the
+
- The uninitialized data that is on the stack will get scanned by the
garbage collector looking for any references to allocated memory. Since
the uninitialized data consists of old D stack frames, it is highly
likely that some of that garbage will look like references into the GC
heap, and the GC memory will not get freed. This problem really does
- happen, and can be pretty frustrating to track down.
+ happen, and can be pretty frustrating to track down.
- - It's possible for a function to pass out of it a reference to data
+
- It's possible for a function to pass out of it a reference to data
on that function's stack frame. By then allocating a new stack frame
over the old data, and not initializing, the reference to the old data
may still appear to be valid. The program will then behave erratically.
Initializing all data on the stack frame will greatly increase the
- probability of forcing that bug into the open in a repeatable manner.
+ probability of forcing that bug into the open in a repeatable manner.
- - Uninitialized data can be a source of bugs and trouble, even when
+
- Uninitialized data can be a source of bugs and trouble, even when
used correctly. One design goal of D is to improve reliability and
portability by eliminating sources of undefined behavior, and
uninitialized data is one huge source of undefined, unportable, erratic
and unpredictable behavior. Hence this idiom should only be used after
other opportunities for speed optimization are exhausted and if
- benchmarking shows that it really does speed up the overall execution.
+ benchmarking shows that it really does speed up the overall execution.
@@ -678,8 +674,7 @@
Therefore, the ISR thread should not be paused.
Threads created with the std.thread
functions will be paused. But threads created with C's
- _beginthread()
- or equivalent won't be, the GC
+ _beginthread() or equivalent won't be, the GC
won't know they exist.
@@ -687,8 +682,7 @@
- The ISR thread cannot allocate any memory using the GC.
- This means that the global new
- cannot be used.
+ This means that the global new cannot be used.
Nor can dynamic arrays be resized, nor can any elements be
added to associative arrays. Any use of the D runtime library
should be examined for any possibility of allocating GC memory -
diff -uNr dmd-0.177/dmd/html/d/mixin.html dmd-0.178/dmd/html/d/mixin.html
--- dmd-0.177/dmd/html/d/mixin.html 2006-12-05 18:54:32.000000000 +0100
+++ dmd-0.178/dmd/html/d/mixin.html 2006-12-10 22:56:56.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:30 2006
+
Last update Sun Dec 10 22:56:55 2006
diff -uNr dmd-0.177/dmd/html/d/module.html dmd-0.178/dmd/html/d/module.html
--- dmd-0.177/dmd/html/d/module.html 2006-12-05 18:54:30.000000000 +0100
+++ dmd-0.178/dmd/html/d/module.html 2006-12-15 00:15:06.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Tue Dec 5 18:54:28 2006
+
Last update Fri Dec 15 00:15:04 2006
@@ -412,6 +412,25 @@
static cannot be used with selective imports.
+Renamed and Selective Imports
+
+ When renaming and selective importing are combined:
+
+import io = std.stdio : foo = writefln;
+
+void main()
+{
+ writefln("bar"); std.stdio.foo("bar"); std.stdio.writefln("bar"); foo("bar"); io.writefln("bar"); io.foo("bar");
+
Module Scope Operator
Sometimes, it's necessary to override the usual lexical scoping rules
diff -uNr dmd-0.177/dmd/html/d/operatoroverloading.html dmd-0.178/dmd/html/d/operatoroverloading.html
--- dmd-0.177/dmd/html/d/operatoroverloading.html 2006-12-08 00:41:20.000000000 +0100
+++ dmd-0.178/dmd/html/d/operatoroverloading.html 2006-12-10 22:56:56.000000000 +0100
@@ -32,7 +32,7 @@
- Last update Fri Dec 8 00:41:19 2006
+
Last update Sun Dec 10 22:56:55 2006
@@ -610,9 +610,9 @@
Future Directions
- The operators =, !, ., &&, ||, ?:, and a few others will likely never
+ The operators !, ., &&, ||, ?:, and a few others will likely never
be overloadable.
-
+
diff -uNr dmd-0.177/dmd/html/d/overview.html dmd-0.178/dmd/html/d/overview.html
--- dmd-0.177/dmd/html/d/overview.html 2006-12-09 00:40:28.000000000 +0100
+++ dmd-0.178/dmd/html/d/overview.html 2006-12-10 22:56:56.000000000 +0100
@@ -23,7 +23,8 @@
- Last update Sat Dec 9 00:40:27 2006
+
Last update Sun Dec 10 22:56:54 2006
@@ -507,9 +508,20 @@
are available.
- - Distinction between . and ->. This distinction
- is really not necessary. The . operator serves just as well for
- pointer dereferencing.
+
- Dumbed down floating point. If one is using hardware that
+ implements modern floating point, it should be available to the
+ programmer rather than having floating point support dumbed down
+ to the lowest common denominator among machines. In particular,
+ a D implementation must support IEEE 754 arithmetic and if
+ extended precision is available it must be supported.
+
+ - Template overloading of < and > symbols.
+ This choice has caused years of bugs, grief, and confusion
+ for programmers, C++ implementors, and C++ source parsing tool
+ vendors. It makes it
+ impossible to parse C++ code correctly without doing a nearly complete
+ C++ compiler. D uses !( and ) which fit neatly and
+ unambiguously into the grammar.
@@ -550,14 +562,21 @@
Numerical programmers. D has many features to directly
- support features needed by numerics programmers, like direct support
- for the complex data type and
- defined behavior for
+ support features needed by numerics programmers, like
+ extended floating point precision,
+ core support for complex and imaginary floating types
+ and defined behavior for
NaN's and infinities.
(These are added in the new
C99 standard, but not in C++.)
+ Programmers who write half their application in scripting
+ langauges like Ruby and Python, and the other half in C++ to
+ speed up the bottlenecks. D has many of the productivity features
+ of Ruby and Python, making it possible to write the entire app
+ in one language.
+
D's lexical analyzer and parser are totally independent of each other and of the
semantic analyzer. This means it is easy to write simple tools to manipulate D source
perfectly without having to build a full compiler. It also means that source code can be
@@ -569,15 +588,12 @@
Who D is Not For
- Realistically, nobody is going to convert million line C or C++
- programs into D, and since D does not compile unmodified C/C++
+ programs into D.
+ 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.)
-
-
- - Very small programs - a scripting or interpreted language like
- Python,
- DMDScript,
- or Perl is likely more suitable.
+ legacy apps.
+ (However, D supports legacy C API's very well. D can connect
+ directly to any code that exposes a C interface.)
- As a first programming language - Basic or Java is more suitable
@@ -641,9 +657,7 @@
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,
+ files with #ifndef/#endif or #pragma once kludges,
etc.
@@ -680,7 +694,6 @@
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++:
@@ -722,6 +735,8 @@
D templates offer a clean way to support generic programming while
offering the power of partial specialization.
+ Template classes and template functions are available, along
+ with variadic template arguments and tuples.
@@ -859,11 +874,9 @@
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
-)
-.)
+).)
- Arrays are not first class objects. When an array is passed to a function, it is
@@ -1298,7 +1311,8 @@
Copyright © 1999-2006 by Digital Mars, All Rights Reserved
|
Page generated by Ddoc. |
-Comments
+Comments