How to get the pointer of "this" ?

Vinod K Chandran kcvinu82 at gmail.com
Tue May 26 17:30:37 UTC 2020


On Tuesday, 26 May 2020 at 14:42:04 UTC, Steven Schveighoffer 
wrote:
On Tuesday, 26 May 2020 at 14:42:04 UTC, Steven Schveighoffer 
wrote:
>
>
> Hm... According to run.dlang.io, this behavior changed in 2.072 
> (prior to that it worked). In  2.067.1 to 2.071.2, changing the 
> this reference was actually allowed, but deprecated.
>
> Technically, you don't need to do this. Passing an address to a 
> class reference isn't going to benefit anything, as a class 
> reference already is a pointer. This is, of course, unless you 
> want to CHANGE the class reference. Which is disallowed for 
> `this`.
>
> Technically speaking, `this` is simply a local parameter. It 
> technically could be changed, but it is not allowed because of 
> the bad code that would likely result.
>
> -Steve

Hi,
Thanks for the reply. I've got the point.


More information about the Digitalmars-d-learn mailing list