this post was submitted on 12 Mar 2024
1090 points (95.7% liked)

Programmer Humor

32078 readers
281 users here now

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

Rules:

founded 5 years ago
MODERATORS
 

Please dont take this seriously guys its just a dumb meme I haven't written a single line of code in half of these languages

you are viewing a single comment's thread
view the rest of the comments
[–] nintendiator@feddit.cl 24 points 6 months ago* (last edited 6 months ago) (2 children)

C:

Problemreturn Solution;

C++:

Problem

const [auto]&& (Problem&& problem) noexcept(noexcept( Solution<Problem>{}(std::forward<Problem>(problem)) )) { return Solution<Problem>{}(std::forward<Problem>(problem)); } -> decltype( Solution<Problem>{}(std::forward<Problem>(problem)) )
[–] xigoi@lemmy.sdf.org 12 points 6 months ago (1 children)

C:

return *(solution_t*)&problem;
[–] nintendiator@feddit.cl 5 points 6 months ago

Maximum optimization!

[–] veniasilente@lemm.ee 4 points 6 months ago (1 children)

But this doesn't return the Solution. You don't invoke the lambda.

(Or does C++ have implied returns now? Last I heard there was implied move)

[–] nintendiator@feddit.cl 2 points 6 months ago

Actually I do; it's the {} that initializes the lambda, and the parenthesis after invokes.

That said, it would have been fun.