Skip to content

Commit 26d4aec

Browse files
committed
rebase
1 parent cabf5f9 commit 26d4aec

38 files changed

+423
-2317
lines changed

abi.dd

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ $(TROW $(I ptrsize)..., $(NBSP), $(ARGS vptr's for any interfaces implemented by
8989

9090
$(TABLE2 Virtual Function Pointer Table Layout,
9191
$(THEAD size, contents)
92-
$(TROW $(I ptrsize), pointer to instance of $(V1 ClassInfo)$(V2 TypeInfo))
92+
$(TROW $(I ptrsize), pointer to instance of TypeInfo)
9393
$(TROW $(I ptrsize)..., pointers to virtual member functions)
9494
)
9595

@@ -152,12 +152,11 @@ $(SECTION3 Interfaces,
152152
that they were declared.
153153
This matches the COM object layout used by Windows.
154154
)
155-
$(V2
156-
$(P A C++ interface differs from a regular interface in that
155+
$(P A C++ interface differs from a regular interface in that
157156
it matches the layout of a C++ class using single inheritance
158157
on the target machine.
159158
)
160-
)
159+
161160
)
162161

163162
$(SECTION3 Arrays,
@@ -192,10 +191,9 @@ $(SECTION3 Associative Arrays,
192191

193192
$(P Associative arrays consist of a pointer to an opaque, implementation
194193
defined type.
195-
$(V1 The current implementation is contained in and defined by
196-
$(PHOBOSSRC internal/aaA.d).)
197-
$(V2 The current implementation is contained in and defined by
198-
$(DRUNTIMESRC rt/aaA.d).)
194+
195+
The current implementation is contained in and defined by
196+
$(DRUNTIMESRC rt/aaA.d).
199197
)
200198
)
201199

@@ -454,7 +452,7 @@ $(I TypePointer):
454452
$(B P) $(I Type)
455453

456454
$(I TypeFunction):
457-
$(I CallConvention) $(V2 $(I FuncAttrs) )$(I Arguments) $(I ArgClose) $(I Type)
455+
$(I CallConvention) $(I FuncAttrs) $(I Arguments) $(I ArgClose) $(I Type)
458456

459457
$(I CallConvention):
460458
$(B F) $(GREEN // D)
@@ -463,7 +461,7 @@ $(I CallConvention):
463461
$(B V) $(GREEN // Pascal)
464462
$(B R) $(GREEN // C++)
465463

466-
$(V2 $(I FuncAttrs):
464+
$(I FuncAttrs):
467465
$(I FuncAttr)
468466
$(I FuncAttr) $(I FuncAttrs)
469467

@@ -493,19 +491,18 @@ $(I FuncAttrTrusted):
493491

494492
$(I FuncAttrSafe):
495493
$(B Nf)
496-
)
494+
497495

498496
$(I Arguments):
499497
$(I Argument)
500498
$(I Argument) $(I Arguments)
501499

502500
$(I Argument:)
503-
$(V2
504501
$(I Argument2)
505502
$(B M) $(I Argument2) $(GREEN // scope)
506503

507504
$(I Argument2:)
508-
) $(I Type)
505+
$(I Type)
509506
$(B J) $(I Type) $(GREEN // out)
510507
$(B K) $(I Type) $(GREEN // ref)
511508
$(B L) $(I Type) $(GREEN // lazy)
@@ -660,7 +657,7 @@ $(SECTION4 Return Value,
660657

661658
$(LI Associative arrays are returned in EAX.)
662659

663-
$(V2 $(LI References are returned as pointers in EAX.))
660+
$(LI References are returned as pointers in EAX.)
664661

665662
$(LI Delegates are returned with the pointer to the function
666663
in EDX and the context pointer in EAX.)

arrays.dd

Lines changed: 32 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,12 @@ int[3] s;
4949
a template expansion.
5050
)
5151

52-
$(V1
53-
$(P Static arrays are value types, but as in C
54-
static arrays are passed to functions by reference
55-
and cannot be returned from functions.
56-
)
57-
)
58-
$(V2
52+
5953
$(P Static arrays are value types. Unlike in C and D version 1,
6054
static arrays are passed to functions by value.
6155
Static arrays can also be returned by functions.
6256
)
63-
)
57+
6458

6559
$(H4 $(LNAME2 dynamic-arrays, Dynamic Arrays))
6660

@@ -418,19 +412,12 @@ double matrix[3,3];
418412

419413
$(H3 $(LNAME2 array-length, Array Length))
420414

421-
$(V1
422-
$(P Within the [ ] of a static or a dynamic array,
423-
the variable $(D length)
424-
is implicitly declared and set to the length of the array.
425-
The symbol $(D $) can also be so used.
426-
)
427-
)
428-
$(V2
415+
429416
$(P Within the [ ] of a static or a dynamic array,
430417
the symbol $(D $)
431418
represents the length of the array.
432419
)
433-
)
420+
434421

435422
---------
436423
int[4] foo;
@@ -440,21 +427,14 @@ int* p = &foo[0];
440427
// These expressions are equivalent:
441428
bar[]
442429
bar[0 .. 4]
443-
$(V1 bar[0 .. length]
444-
)bar[0 .. $]
430+
bar[0 .. $]
445431
bar[0 .. bar.length]
446432

447-
$(V1 p[0 .. length] // 'length' is not defined, since p is not an array
448-
bar[0]+length // 'length' is not defined, out of scope of [ ]
449433

450-
bar[length-1] // retrieves last element of the array
451-
)
452-
$(V2
453-
p[0 .. $] // '$' is not defined, since p is not an array
454-
bar[0]+$ // '$' is not defined, out of scope of [ ]
434+
p[0 .. $] // '$' is not defined, since p is not an array
435+
bar[0]+$ // '$' is not defined, out of scope of [ ]
455436

456-
bar[$-1] // retrieves last element of the array
457-
)
437+
bar[$-1] // retrieves last element of the array
458438
---------
459439

460440
$(H3 $(LNAME2 array-properties, Array Properties))
@@ -464,20 +444,19 @@ $(H3 $(LNAME2 array-properties, Array Properties))
464444
$(TABLE_2COLS Static Array Properties,
465445
$(THEAD Property, Description)
466446
$(TROW $(D .init),
467-
$(V1 returns the default initializer for the element type.)
468-
$(V2 Returns an array literal with each element of the literal being the $(D .init) property of the array element type.))
447+
Returns an array literal with each element of the literal being the $(D .init) property of the array element type.)
469448
$(TROW $(D .sizeof), Returns the array length multiplied by
470449
the number of bytes per array element.)
471450
$(TROW $(D .length), Returns the number of elements in the array.
472451
This is a fixed quantity for static arrays. It is of type $(D size_t).)
473452
$(TROW $(D .ptr), Returns a pointer to the first element of the array.)
474453
$(TROW $(D .dup), Create a dynamic array of the same size and copy the contents of the array into it.)
475-
$(TROW $(D .idup), Create a dynamic array of the same size and copy the contents of the array into it.
476-
The copy is typed as being immutable. $(I D 2.0 only))
454+
$(TROW $(D .idup), Create a dynamic array of the same size and copy the contents of the array into it. The copy is typed as being immutable.)
477455
$(TROW $(D .reverse), Reverses in place the order of the elements in the array.
478456
Returns the array.)
479457
$(TROW $(D .sort), Sorts in place the order of the elements in
480-
the array. Returns the array.))
458+
the array. Returns the array.)
459+
)
481460

482461
$(P Dynamic array properties are:)
483462

@@ -508,13 +487,9 @@ $(V2 Returns an array literal with each element of the literal being the $(D .in
508487
$(P For the $(D .sort) property to work on arrays of
509488
structs or unions, the struct or union definition must
510489
define the function:
511-
$(V1
512-
$(D int opCmp(S)) or
513-
$(D int opCmp(S*)).
514-
)
515-
$(V2
490+
516491
$(D int opCmp(ref const S) const).
517-
)
492+
518493
The type $(D S) is the type of the struct or union.
519494
This function will determine the sort ordering.
520495
)
@@ -562,40 +537,14 @@ array = array[0..7];
562537

563538
$(P To maximize efficiency, the runtime always tries to resize the
564539
array in place to avoid extra copying.
565-
$(V1 It will always do a copy if the new size is larger and the array
566-
was not allocated via the new operator or a previous resize operation.)
567-
$(V2 It will always do a copy if the new size is larger and the array
540+
541+
It will always do a copy if the new size is larger and the array
568542
was not allocated via the new operator or resizing in place would
569-
overwrite valid data in the array.)
543+
overwrite valid data in the array.
570544
)
571545

572-
$(V1 $(P This means that if there is an array slice immediately following the
573-
array being resized, the resized array could overlap the slice; i.e.:
574-
)
575546

576-
---------
577-
char[] a = new char[20];
578-
char[] b = a[0..10];
579-
char[] c = a[10..20];
580547

581-
b.length = 15; // always resized in place because it is sliced
582-
// from a[] which has enough memory for 15 chars
583-
b[11] = 'x'; // a[11] and c[1] are also affected
584-
585-
a.length = 1;
586-
a.length = 20; // no net change to memory layout
587-
588-
c.length = 12; // always does a copy because c[] is not at the
589-
// start of a gc allocation block
590-
c[5] = 'y'; // does not affect contents of a[] or b[]
591-
592-
a.length = 25; // may or may not do a copy
593-
a[3] = 'z'; // may or may not affect b[3] which still overlaps
594-
// the old a[3]
595-
---------
596-
)
597-
598-
$(V2
599548
For example:
600549

601550
---------
@@ -623,12 +572,12 @@ a.length = 25; // This always reallocates because if c extended in place,
623572
// which will still be true for a.
624573
a[15] = 'z'; // does not affect c, because either a or c has reallocated.
625574
---------
626-
)
575+
627576

628577
$(P To guarantee copying behavior, use the .dup property to ensure
629-
a unique array that can be resized. $(V2 Also, one may use the phobos
578+
a unique array that can be resized. Also, one may use the phobos
630579
$(D .capacity) property to determine how many elements can be appended
631-
to the array without reallocating.)
580+
to the array without reallocating.
632581
)
633582

634583
$(P These issues also apply to appending arrays with the ~= operator.
@@ -646,7 +595,7 @@ while (1) {
646595
c = getinput();
647596
if (!c)
648597
break;
649-
$(V2 ++array.length;)$(V1 array.length = array.length + 1;)
598+
++array.length;
650599
array[array.length - 1] = c;
651600
}
652601
---------
@@ -663,7 +612,7 @@ for (i = 0; ; i++) {
663612
if (!c)
664613
break;
665614
if (i == array.length)
666-
$(V2 array.length *= 2;)$(V1 array.length = array.length * 2;)
615+
array.length *= 2;
667616
array[i] = c;
668617
}
669618
array.length = i;
@@ -675,8 +624,8 @@ array.length = i;
675624
input from the console - it's unlikely to be longer than 80.
676625
)
677626

678-
$(V2 $(P Also, you may wish to utilize the phobos $(D reserve)
679-
function to pre-allocate array data to use with the append operator.))
627+
$(P Also, you may wish to utilize the phobos $(D reserve)
628+
function to pre-allocate array data to use with the append operator.)
680629

681630
$(H4 $(LNAME2 func-as-property, Functions as Array Properties))
682631

@@ -696,7 +645,7 @@ $(H3 $(LNAME2 bounds, Array Bounds Checking))
696645

697646
$(P It is an error to index an array with an index that is less than
698647
0 or greater than or equal to the array length. If an index is
699-
out of bounds, $(V1 an ArrayBoundsError)$(V2 a RangeError) exception is
648+
out of bounds, a RangeError exception is
700649
raised if detected at runtime, and an error if detected at compile
701650
time. A program may not rely on array bounds checking happening, for
702651
example, the following program is incorrect:
@@ -796,23 +745,7 @@ $(H4 $(LNAME2 strings, Strings))
796745
String literals are immutable (read only).
797746
)
798747

799-
$(V1
800-
---------
801-
char[] str;
802-
char[] str1 = "abc";
803-
str[0] = 'b'; // error, "abc" is read only, may crash
804-
---------
805-
806-
$(P The name $(CODE string) is aliased to $(CODE char[]),
807-
so the above declarations could be equivalently written as:
808-
)
809748

810-
---------
811-
string str;
812-
string str1 = "abc";
813-
---------
814-
)
815-
$(V2
816749
---------
817750
char[] str1 = "abc"; // error, "abc" is not mutable
818751
char[] str2 = "abc".dup; // ok, make mutable copy
@@ -831,7 +764,7 @@ string str3 = "abc"; // ok
831764
string str4 = str1; // error, str4 is not mutable
832765
string str5 = str1.idup; // ok, make immutable copy
833766
---------
834-
)
767+
835768
$(P $(CODE char[]) strings are in UTF-8 format.
836769
$(CODE wchar[]) strings are in UTF-16 format.
837770
$(CODE dchar[]) strings are in UTF-32 format.
@@ -882,14 +815,10 @@ str ~= "\0";
882815
)
883816

884817
---------
885-
$(V1
886-
cast(wchar [])"abc" // this is an array of wchar characters
887-
"abc"w // so is this
888-
)
889-
$(V2
818+
890819
cast(immutable(wchar) [])"abc" // this is an array of wchar characters
891820
"abc"w // so is this
892-
)
821+
893822
---------
894823

895824
$(P String literals that do not have a postfix character and that
@@ -976,8 +905,8 @@ $(H4 $(LNAME2 implicit-conversions, Implicit Conversions))
976905

977906
$(UL
978907
$(LI $(D T[]))
979-
$(V1 $(LI $(D U[])))
980-
$(V2 $(LI $(D const(U)[])))
908+
909+
$(LI $(D const(U)[]))
981910
$(LI $(D void[]))
982911
)
983912

@@ -986,8 +915,8 @@ $(H4 $(LNAME2 implicit-conversions, Implicit Conversions))
986915
)
987916

988917
$(UL
989-
$(V1 $(LI $(D U[])))
990-
$(V2 $(LI $(D const(U)[])))
918+
919+
$(LI $(D const(U)[]))
991920
$(LI $(D void[]))
992921
)
993922

0 commit comments

Comments
 (0)