230
True Story (lemmy.world)
you are viewing a single comment's thread
view the rest of the comments
[-] Lauchmelder@feddit.de 41 points 8 months ago* (last edited 8 months ago)

Why are you putting the implementation in the .h file? You're supposed to declare in the header and implement in the .cpp files. The meme is reversed

[-] Lauchmelder@feddit.de -3 points 8 months ago

The reason is that header files are pretty much copy/pasted into your c files when you include them. so the code in them keeps getting recompiled for every c file, which drastically increases overall build times. If you only declare in the header and have one c file implementing the functions you compile them only once.

[-] victorz@lemmy.world 11 points 8 months ago

AI reply? That's the point they're trying to make. The implementation shouldn't be in the header file, but it is. Look at the image.

[-] Lauchmelder@feddit.de -2 points 8 months ago

pretty sure the meme is about how the implementation looks ugly but using the implementation looks good because all the code is abstracted away. if it was like you said then why would they compare the code to the main.cpp

[-] victorz@lemmy.world 1 points 8 months ago

I got confused. I was referring to the top-level comment in this thread, but that was actually posted by you, so... I got turned around.

But yeah, sounds about right, that the meme could be referring to the horrors in the h file vs the clean cpp file. ๐Ÿ˜„

load more comments (5 replies)
load more comments (14 replies)
this post was submitted on 22 Mar 2024
230 points (94.2% liked)

Programmer Humor

32490 readers
488 users here now

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

Rules:

founded 5 years ago
MODERATORS