306
submitted 10 months ago by qaz@lemmy.world to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] schnurrito@discuss.tchncs.de 30 points 10 months ago

"result" is fine. That is the variable you will end up returning that you have to fill with stuff first.

"data" on the other hand…

[-] hal_canary 5 points 10 months ago

I came here to say this.

Declare result in the first line of the function and return result is the last line. In C++, this is a big hint to the compiler that you want return value optimization to kick in.

this post was submitted on 15 Oct 2023
306 points (95.0% liked)

Programmer Humor

31700 readers
744 users here now

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

Rules:

founded 5 years ago
MODERATORS