reflaxe.CPP icon indicating copy to clipboard operation
reflaxe.CPP copied to clipboard

Bad pointer to pointer generation

Open fourst4r opened this issue 2 years ago • 1 comments

Building

function main() {
    var i:Int = 123;
    var p:cxx.Ptr<Int> = i;
    var pp:cxx.Ptr<cxx.Ptr<Int>> = p;
    trace(pp); // bypass dce
}

Will generate the output

int i = 123;
int* p = &i;
int* pp = p;

Shouldn't it be int** pp = &p?

fourst4r avatar Jun 23 '23 13:06 fourst4r

Ooof, yeah, I forgot about pointer stacking. As always, thanks for the report! I think for this, I might be able to add a secondary, optional parameter as well, something like cxx.Ptr<T, 2> to generate T** without having to write out so many Ptr classes.

On unrelated note, I seriously appreciate all these issues!! Sorry for the delay in response, busy atm, but I should be able to begin work on Reflaxe/C++ shortly and fix all of these!

SomeRanDev avatar Jun 27 '23 08:06 SomeRanDev