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.

[-] bort@sopuli.xyz -3 points 8 months ago

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 3 points 8 months ago

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

[-] bort@sopuli.xyz 1 points 8 months ago
load more comments (4 replies)
load more comments (13 replies)
this post was submitted on 22 Mar 2024
230 points (94.2% liked)

Programmer Humor

32481 readers
349 users here now

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

Rules:

founded 5 years ago
MODERATORS