Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1262

Answer by HolyBlackCat for Why is it illegal to take the address of the "this" pointer?

$
0
0

This is an artificial restriction.

Compiler optimizations aside, this acts as a hidden pointer parameter to member functions. (Yes, it could sit in a register, but so can regular pointer parameters).

There's no reason this couldn't have worked. My best guess is that nobody thought it would be useful, so they made this a prvalue, which essentially prevents taking its address.


Viewing all articles
Browse latest Browse all 1262

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>