Background: This is an old topic I studied multiple times, but still unfamiliar. I think most people don’t work at such a low level?
Q1: Can return a malloc object by reference? I tested. You can still get the address by taking the address of the reference.
Q1b: if you only have a reference to a heap object, how can you delete it? See https://bintanvictor.wordpress.com/?p=10505&preview=true
Q: Can return a static local by reference? I think so but not popular
Q: Can return a by-ref argument by reference? No need (but legal) since the caller already has that reference. You could return it in an if/else
Q: can return another object in scope by reference? Yes
Return-by-non-const-ref is often used in operator overloading to support counter[3].increment()
The assignment operator returns a const ref.