On 8/11/2016 1:29 AM, John Colvin wrote:
Can someone talk me through the lifetime algebra for the following?

void foo()
{
    int a;
    int** c;
    void bar()
    {
        int* b = &a;  <= ok, b has a smaller lifetime than a
        c = &b;    <= error, c has a larger lifetime than b
    }
    bar();
    *c; //undefined behaviour
}

Reply via email to