this post was submitted on 22 Mar 2024
0 points (NaN% liked)

Programmer Humor

31997 readers
773 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Lauchmelder@feddit.de 0 points 5 months ago (2 children)

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.

[–] bort@sopuli.xyz 0 points 5 months ago (1 children)

drastically increases overall build times

oh wow. from 0ms all the way up to 0ms. That's almost 1000 times faster wow.

[–] Lauchmelder@feddit.de 0 points 5 months ago

truly spoken like someone who has never worked on a large C/C++ project

[–] victorz@lemmy.world 0 points 5 months ago (1 children)

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 0 points 5 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