245

Alt text:

Image that says:

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

int& a = b;

you are viewing a single comment's thread
view the rest of the comments
[-] firelizzard@programming.dev 4 points 4 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.

this post was submitted on 03 May 2024
245 points (94.2% liked)

Programmer Humor

31990 readers
62 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS