fxm wrote:I wrote about thirty articles in the Programmer's Guide
Hi fxm! I downloaded the last chm, I had them all now, and they render very well in this format as well. Thanks for all this good stuff.
But about the last challenge, following the insight from dodicat, what if we try a placement new[] pointing in the middle of an array? I tried that, when I delete[] at one index, things are messed up in all the array:
Code: Select all
type DESTR_UDT
declare destructor()
as integer dii
end type
destructor DESTR_UDT()
this.dii = -111
end destructor
type TESTOBJ as DESTR_UDT
redim as TESTOBJ arr(1 to 2)
clear arr(1), , 2*SizeOf(TESTOBJ)
'? sizeOf(TESTOBJ), sizeOf(byte)
for i as integer = 0 to 2*SizeOf(TESTOBJ)/sizeOf(byte) - 1
? "..";i , cast(byte ptr, @arr(1))[i]
next i
? "/////////////////////////////"
? cast(integer ptr, @arr(1))[0]
? cast(integer ptr, @arr(2))[0]
dim as TESTOBJ ptr dd = new (@arr(2)) TESTOBJ[1]
for i as integer = 0 to 2*SizeOf(TESTOBJ)/sizeOf(byte) - 1
? "..";i , cast(byte ptr, @arr(1))[i]
next i
? "/////////////////////////////"
? cast(integer ptr, @arr(1))[0]
? cast(integer ptr, @arr(2))[0]
? : ? "DELETE dd"
delete[] dd
for i as integer = 0 to 2*SizeOf(TESTOBJ)/sizeOf(byte) - 1
? "..";i , cast(byte ptr, @arr(1))[i]
next i
? "/////////////////////////////"
? cast(integer ptr, @arr(1))[0]
? cast(integer ptr, @arr(2))[0]
.. 0 0
.. 1 0
.. 2 0
.. 3 0
.. 4 0
.. 5 0
.. 6 0
.. 7 0
/////////////////////////////
0
0
.. 0 0
.. 1 0
.. 2 0
.. 3 0
.. 4 0
.. 5 0
.. 6 0
.. 7 0
/////////////////////////////
0
0
DELETE dd / array(2)
.. 0 -72
.. 1 22
.. 2 -100
.. 3 0
.. 4 -64
.. 5 0
.. 6 -100
.. 7 0
/////////////////////////////
10229432
10223808