static function and access frame

Alex sascha.orlov at gmail.com
Tue Jan 23 23:08:41 UTC 2018


On Tuesday, 23 January 2018 at 22:59:31 UTC, Steven Schveighoffer 
wrote:
> On 1/23/18 5:52 PM, Steven Schveighoffer wrote:
>> I don't know the reason. You would think that accessing s 
>> would be relative to T.fun's stack frame, and have nothing to 
>> do with an instance of T.
>> 
>
> using -vcg-ast gives a hint:
>
> https://run.dlang.io/is/MZHPTY
>
> Note that the T!(s) struct has a void *this member, that is 
> probably the main stack frame pointer.
>
> -Steve

So, if change the fun to static, it cannot pickup the pointer and 
therefore can't call anything of the aliased object. If I get it 
right...

cool option, by the way... didn't know anything about it. What 
does -ast do?


More information about the Digitalmars-d-learn mailing list