How to get the pointer of "this" ?

Vinod K Chandran kcvinu82 at gmail.com
Tue May 26 14:17:19 UTC 2020


On Tuesday, 26 May 2020 at 13:48:52 UTC, ag0aep6g wrote:
> On 26.05.20 15:43, Vinod K Chandran wrote:
>> So far now, two solutions are very clear for this problem.
>> 1. As per John Chapman's suggestion - use 
>> cast(DWORD_PTR)cast(void*)this).
>> 2. Use another varibale to use as an lvalue. -
>>       Button dummyBtn = this;
>>       cast(DWORD_PTR)&dummyBtn;
>> Among these two, i think 2nd option is good. Am i right ?
>
> No. Use option 1.

Could you please tell me why ?


More information about the Digitalmars-d-learn mailing list