Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some languages do define &&b, like Rust, where its effect is similar to the parent post's C example: it creates a temporary stack allocation initialized with &b, and then takes the address of that.

You could argue this is inconsistent or confusing. It is certainly useful though.

Incidentally, C99 lets you do something similar with compound literal syntax; this is a valid expression:

    &(int *){&b}




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: