Is the “this” pointer just a compile time thing?

So is the this pointer just a compile time thing and not an actual pointer?

It very much is a run time thing. It refers to the object on which the member function is invoked, naturally that object can exist at run time.

What is a compile time thing is how name lookup works. When a compiler encounters x = X it must figure out what is this x that is being assigned. So it looks it up, and finds the member variable. Since this->x and x refer to the same thing, naturally you get the same assembly output.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)