tango.core.tools.WinStackTrace

Stacktracing
Inclusion of this module activates traced exceptions using the tango own tracers if possible

License:

tango license, apache 2.0

Authors:

Tomasz Stachowiak (h3r3tic)
void alloc(T, intT)(ref T array, intT numItems, bool init = true) #
Allocate the array using malloc

Params:

arraythe array which will be resized
numItemsnumber of items to be allocated in the array
initwhether to init the allocated items to their default values or not

Examples:

int[] foo; foo.alloc(20);

Remarks:

The array must be null and empty for this function to succeed. The rationale behind this is that the coder should state his decision clearly. This will help and has already helped to spot many intricate bugs.
T clone(T)(T array) #
Clone the given array. The result is allocated using alloc() and copied piecewise from the param. Then it's returned
void realloc(T, intT)(ref T array, intT numItems, bool init = true) #
Realloc the contents of an array array = the array which will be resized numItems = the new size for the array init = whether to init the newly allocated items to their default values or not

Examples:

int[] foo; foo.alloc(20); foo.realloc(10); // <--
void free(T)(ref T array) #
Deallocate an array allocated with alloc()
void append(T, I)(ref T array, I elem, uint* realLength = null) #
Append an item to an array. Optionally keep track of an external 'real length', while doing squared reallocation of the array

Params:

arraythe array to append the item to
elemthe new item to be appended
realLengththe optional external 'real length'

Remarks:

if realLength isn't null, the array is not resized by one, but allocated in a std::vector manner. The array's length becomes it's capacity, while 'realLength' is the number of items in the array.

Examples:

1
2
3
4
5
6
7
8
uint barLen = 0;
int[] bar;
append(bar, 10, &barLen);
append(bar, 20, &barLen);
append(bar, 30, &barLen);
append(bar, 40, &barLen);
assert (bar.length == 16);
assert (barLen == 4);