Is this documented behaviour?

John Colvin john.loughran.colvin at gmail.com
Wed Jul 24 08:11:16 PDT 2013


On Wednesday, 24 July 2013 at 15:03:33 UTC, Dicebot wrote:
> On Tuesday, 23 July 2013 at 20:13:33 UTC, John Colvin wrote:
>> To be honest, I wasn't expecting foo(*aptr) to compile at all, 
>> with a "taking address of temporary" error or similar.
>
> But there are no temporaries here. You seem to mix concepts of 
> "temporary" and "stack variable with deterministic lifetime". 
> Taking address of a temporary is something like this:
>
> int foo() { return 42; }
> ...
> int* ptr = &(foo());

nope, I get that. I was just confusing the basics of how pointers 
work *facepalm*


More information about the Digitalmars-d-learn mailing list