TArray<T> = record
//..stuff...
end;
f_first := ^TBlock<T>(malloc(sizeOf(TBlock<T>) * cnt)); //gives always nil back, nvm if I use it from CRUNTIME or from rtl.
when I do this:
TArray<T> = class
//..stuff...
end;
f_first := ^TBlock<T>(malloc(sizeOf(TBlock<T>) * cnt)); //gives a valid pointer back to the allocated memory!
No no^^, when TArray is class and do this “f_first := ^TBlock(malloc(sizeOf(TBlock) * cnt));” , I get a valid pointer, when I change:TArray to record, I get with the same line, always nil ptr, this should nothing have to do whether I pick class or record as type-definition
It’s perfectly fine actually, seems the debugger just gets confused when the exception gets thrown. You never set fCount, so it’s always 0 so always fails.
When I make array a class it still allocates fine:
Yes you are right, that was my bad, it should be: 0<=position<=f_currenct_capacity
Change it to record, because I said that it works pretty fine with class, but the moment you make Tarray a record, it gives {0} back
And unfortunately, I have to say, that the Debugger isn’t 100% useful, as it should be in this stage, because I really cant watch any of the variables or other expressions, that makes debugging really hard, when I cant inspect the values in the watch-window
I dont want to anoy the shit out of you, but just for summarization-reason, I want to add, that currently, I cant even see any local-variable in the debug-window, so, no watch-window nor localvariable-window.