Coder's Guild Mailing List

Re:C++ Destructor and Assembly

Posted by Osipov Alexey on 1999-11-02

Hi.
It is quite natural that destructor used atomaticaly then you define
your function like this(copy of your struct is created):

> void MEM_BITMAP::TransCopy(MEM_BITMAP dest, int x, int y);

Then you define it like this(dest is reference to struct):

void MEM_BITMAP::TransCopy(MEM_BITMAP &dest, int x, int y);

You recieve an address of (pointer to) struct (I am not sure is it far
or
not) but you have to upload this address (e.g. LES SI,dest).
To refere to it elements use offset from this address(e.g. MOV
ES:[SI],0).
I am not acknowledged with DJGPP and power of it's built in assembler
compiler but I hope that will help.

At the end a little question : Why there is no int x, int y in function
prototype in comparation with function definition ?

> void TransCopy(MEM_BITMAP dest);
> void MEM_BITMAP::TransCopy(MEM_BITMAP dest, int x, int y);

Bye.