Alt text:

Image that says:

HOLY SHIT!! IS THAT A MOTHERF*CKING C++ REFERENCE???

int& a = b;

  • Ethan
    link
    fedilink
    English
    arrow-up
    4
    ·
    8 months ago

    For references within a scope, you’re probably right. For references that cross scope boundaries (i.e. function parameters), they necessarily must consume memory (or a register). Passing a parameter to a function call consumes memory or a register by definition. If a function call is inlined, that means its instructions are copy-pasted to the call location so there’s no actual call in the compiled code.