Skip to content

Commit

Permalink
Fix a bunch of kindlegen warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
andralex committed Jan 4, 2013
1 parent a33a6cf commit 12c24a3
Show file tree
Hide file tree
Showing 21 changed files with 472 additions and 599 deletions.
37 changes: 16 additions & 21 deletions class.dd
Expand Up @@ -115,7 +115,7 @@ Foo var;
$(P Access to class members is controlled using $(GLINK2 attribute, ProtectionAttribute)s.
The default protection attribute is $(D public).
Access control does not affect visibility.
)
)

<h3>Fields</h3>

Expand Down Expand Up @@ -283,10 +283,9 @@ class Abc {

This static initialization is done before any constructors are
called.
<p>

Constructors are defined with a function name of $(B this)
and having no return value:
$(P Constructors are defined with a function name of $(B this)
and having no return value:)

------
class Foo {
Expand Down Expand Up @@ -336,10 +335,9 @@ class C {
If no call to constructors via $(B this) or $(B super) appear
in a constructor, and the base class has a constructor, a call
to $(B super)() is inserted at the beginning of the constructor.
<p>

If there is no constructor for a class, but there is a constructor
for the base class, a default constructor of the form:
$(P If there is no constructor for a class, but there is a constructor
for the base class, a default constructor of the form:)

------
this() { }
Expand Down Expand Up @@ -523,16 +521,15 @@ class Foo {
a runtime error? Additional confusion comes from it not being obvious if
an initializer is
static or dynamic.
<p>

D makes this simple. All member initializations must be determinable by
$(P D makes this simple. All member initializations must be determinable by
the compiler at
compile time, hence there is no order-of-evaluation dependency for
member
initializations, and it is not possible to read a value that has not
been initialized. Dynamic
initialization is performed by a static constructor, defined with
a special syntax $(D static this()).
a special syntax $(D static this()).)

------
class Foo {
Expand Down Expand Up @@ -735,18 +732,18 @@ new(1,2) Foo(a); // calls new(Foo.sizeof,1,2)
)

<h3>$(LNAME2 deallocators, Class Deallocators)</h3>
$(B Note): Class deallocators and the delete operator are deprecated in D2.
Use the $(B destroy) function to finalize an object by calling its destructor.
The memory of the object is $(B not) immediately deallocated, instead the GC
$(B Note): Class deallocators and the delete operator are deprecated in D2.
Use the $(B destroy) function to finalize an object by calling its destructor.
The memory of the object is $(B not) immediately deallocated, instead the GC
will collect the memory of the object at an undetermined point after finalization:

------
class Foo { int x; this() { x = 1; } }
Foo foo = new Foo;
destroy(foo);
assert(foo.x == int.init); // object is still accessible
------

$(GRAMMAR
$(GNAME ClassDeallocator):
$(B delete) $(GLINK2 declaration, Parameters) $(GLINK2 function, FunctionBody)
Expand Down Expand Up @@ -887,10 +884,9 @@ scope class Foo { ... }

The scope characteristic is inherited, so if any classes derived
from a scope class are also scope.
<p>

An scope class reference can only appear as a function local variable.
It must be declared as being $(B scope):
$(P An scope class reference can only appear as a function local variable.
It must be declared as being $(B scope):)

------
scope class Foo { ... }
Expand Down Expand Up @@ -978,13 +974,12 @@ void func() {
that is the frame pointer of the enclosing function if it is nested
inside a function, or the $(B this) of the enclosing class's instance
if it is nested inside a class.
<p>

When a non-static nested class is instantiated, the context pointer
$(P When a non-static nested class is instantiated, the context pointer
is assigned before the class's constructor is called, therefore
the constructor has full access to the enclosing variables.
A non-static nested class can only be instantiated when the necessary
context pointer information is available:
context pointer information is available:)

------
class Outer {
Expand Down
137 changes: 59 additions & 78 deletions comparison.dd
Expand Up @@ -427,76 +427,65 @@ $(SECTION2 Notes,

<dl>

<dt><a name="ObjectOriented">Object Oriented</a>
<dd>This means support for classes, member functions,
inheritance, and virtual function dispatch.
<p>
$(DT <a name="ObjectOriented">Object Oriented</a>)
$(DD This means support for classes, member functions,
inheritance, and virtual function dispatch.)

<dt><a name="InlineAssembler">Inline assembler</a>
<dd> Many C and C++ compilers support an inline assembler, but
$(P $(DT <a name="InlineAssembler">Inline assembler</a>)
$(DD Many C and C++ compilers support an inline assembler, but
this is not a standard part of the language, and implementations
vary widely in syntax and quality.
<p>
vary widely in syntax and quality.))

<dt><a name="Interfaces">Interfaces</a>
<dd> Support in C++ for interfaces is weak enough that an
IDL (Interface Description Language) was invented to compensate.
<p>
$(P $(DT <a name="Interfaces">Interfaces</a>)
$(DD Support in C++ for interfaces is weak enough that an
IDL (Interface Description Language) was invented to compensate.))

<dt><a name="Modules">Modules</a>
<dd> Many correctly argue that C++ doesn't really have modules.
$(P $(DT <a name="Modules">Modules</a>)
$(DD Many correctly argue that C++ doesn't really have modules.
But C++ namespaces coupled with header files share many features
with modules.
<p>
with modules.))

<dt><a name="GarbageCollection">Garbage Collection</a>
<dd> The Hans-Boehm garbage collector can be successfully used
with C and C++, but it is not a standard part of the language.
<p>
$(P $(DT <a name="GarbageCollection">Garbage Collection</a>)
$(DD The Hans-Boehm garbage collector can be successfully used
with C and C++, but it is not a standard part of the language.))

<dt><a name="ImplicitTypeInference">Implicit Type Inference</a>
<dd> This refers to the ability to pick up the type of a
declaration from its initializer.
<p>
$(P $(DT <a name="ImplicitTypeInference">Implicit Type Inference</a>)
$(DD This refers to the ability to pick up the type of a
declaration from its initializer.))

<dt><a name="Contracts">Contract Programming</a>
<dd>The Digital Mars C++ compiler supports
$(P $(DT <a name="Contracts">Contract Programming</a>)
$(DD The Digital Mars C++ compiler supports
<a href="http://www.digitalmars.com/ctg/contract.html">Contract Programming</a>
as an extension.
Compare some <a href="cppdbc.html">C++ techniques</a> for
doing Contract Programming with D.
<p>
doing Contract Programming with D.))

<dt><a name="ResizeableArrays">Resizeable arrays</a>
<dd>Part of the standard library for C++ implements resizeable
$(P $(DT <a name="ResizeableArrays">Resizeable arrays</a>)
$(DD Part of the standard library for C++ implements resizeable
arrays, however, they are not part of the core language.
A conforming freestanding implementation of C++ (C++98 17.4.1.3) does
not need to provide these libraries.
<p>
not need to provide these libraries.))

<dt><a name="BuiltinStrings">Built-in Strings</a>
<dd>Part of the standard library for C++ implements strings,
$(P $(DT <a name="BuiltinStrings">Built-in Strings</a>)
$(DD Part of the standard library for C++ implements strings,
however, they are not part of the core language.
A conforming freestanding implementation of C++ (C++98 17.4.1.3) does
not need to provide these libraries.
$(REDO Here's a <a href="cppstrings.html">comparison</a> of C++ strings
and D built-in strings.)
<p>
and D built-in strings.)))

<dt><a name="StrongTypedefs">Strong typedefs</a>
<dd>Strong typedefs can be emulated in C/C++ by wrapping a type
$(P $(DT <a name="StrongTypedefs">Strong typedefs</a>)
$(DD Strong typedefs can be emulated in C/C++ by wrapping a type
in a struct. Getting this to work right requires much tedious
programming, and so is considered as not supported.
<p>
programming, and so is considered as not supported.))

<dt><a name="debuggers">Use existing debuggers</a>
<dd>By this is meant using common debuggers that can operate
$(P $(DT <a name="debuggers">Use existing debuggers</a>)
$(DD By this is meant using common debuggers that can operate
using debug data in common formats embedded in the executable.
A specialized debugger useful only with that language is not required.
<p>
A specialized debugger useful only with that language is not required.))

<dt><a name="StructMemberAlignmentControl">Struct member alignment control</a>
<dd>Although many C/C++ compilers contain pragmas to specify
$(P $(DT <a name="StructMemberAlignmentControl">Struct member alignment control</a>)
$(DD Although many C/C++ compilers contain pragmas to specify
struct alignment, these are nonstandard and incompatible from
compiler to compiler.<br>
The C# standard ECMA-334 25.5.8 says only this about struct member
Expand All @@ -508,69 +497,61 @@ $(SECTION2 Notes,
indeterminate.")
Therefore, although Microsoft may
have extensions to support specific member alignment, they are not an
official part of standard C#.
<p>
official part of standard C#.))

<dt><a name="Ctypes">Support all C types</a>
<dd>C99 adds many new types not supported by C++.
<p>
$(DT <a name="Ctypes">Support all C types</a>)
$(DD C99 adds many new types not supported by C++.)

<dt><a name="LongDouble">80 bit floating point</a>
<dd>While the standards for C and C++ specify long doubles, few
$(P $(DT <a name="LongDouble">80 bit floating point</a>)
$(DD While the standards for C and C++ specify long doubles, few
compilers (besides Digital Mars C/C++) actually implement
80 bit (or longer) floating point types.
<p>
80 bit (or longer) floating point types.))

<dt><a name="mixins">Mixins</a>
<dd>Mixins have many different meanings in different programming
$(P $(DT <a name="mixins">Mixins</a>)
$(DD Mixins have many different meanings in different programming
languages. <a href="template-mixin.html">D mixins</a> mean taking an arbitrary
sequence of declarations
and inserting (mixing) them into the current scope. Mixins can be done
at the global, class, struct, or local level.
<p>
at the global, class, struct, or local level.))

<dt><a name="cppmixins">C++ Mixins</a>
<dd>C++ mixins refer to a couple different techniques. The first
$(P $(DT <a name="cppmixins">C++ Mixins</a>)
$(DD C++ mixins refer to a couple different techniques. The first
is analogous to D's interface classes. The second is to create
a template of the form:
a template of the form:))
$(CPPCODE
template &lt;class Base&gt; class Mixin : public Base
{
... mixin body ...
}
)
D mixins are different.
<p>

<dt><a name="staticif">Static If</a>
<dd>The C and C++ preprocessor directive #if would appear to
$(P $(DT <a name="staticif">Static If</a>)
$(DD The C and C++ preprocessor directive #if would appear to
be equivalent to the D static if. But there are major and crucial
differences - the #if does not have access to any of the constants,
types, or symbols of the program. It can only access preprocessor
macros.
See <a href="cpptod.html#metatemplates">this example</a>.
<p>
See <a href="cpptod.html#metatemplates">this example</a>.))

<dt><a name="isexpression">Is Expressions</a>
<dd>$(I Is expressions) enable conditional compilation based
$(DT <a name="isexpression">Is Expressions</a>)
$(DD $(I Is expressions) enable conditional compilation based
on the characteristics of a type. This is done after a fashion in
C++ using template parameter pattern matching.
See <a href="cpptod.html#typetraits">this example</a>
for a comparison of the different approaches.
<p>
for a comparison of the different approaches.)

<dt><a name="innerclasses">Inner (adaptor) classes</a>
<dd>A $(I nested class) is one whose definition is within the scope
$(P $(DT <a name="innerclasses">Inner (adaptor) classes</a>)
$(DD A $(I nested class) is one whose definition is within the scope
of another class. An $(I inner class) is a nested class that
can also reference the members and fields of the lexically
enclosing class; one can think of it as if it contained a 'this'
pointer to the enclosing class.
<p>
pointer to the enclosing class.))

<dt><a name="DocComments">Documentation comments</a>
<dd>Documentation comments refer to a standardized way to produce
$(P $(DT <a name="DocComments">Documentation comments</a>)
$(DD Documentation comments refer to a standardized way to produce
documentation from the source code file using specialized
comments.
comments.))

</dl>
)
Expand Down

0 comments on commit 12c24a3

Please sign in to comment.