@Lauchmelder@feddit.de
link
fedilink
Deutsch
-36M

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.

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
link
fedilink
Deutsch
36M

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

deleted by creator

thank god

Yeah that’s why you’re supposed to use header guards… If you don’t and include your header in multiple places your program straight up won’t compile.

Victor
link
fedilink
116M

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
link
fedilink
Deutsch
-26M

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

Victor
link
fedilink
16M

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. 😄

Create a post

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

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 120 users / day
  • 257 users / week
  • 744 users / month
  • 3.72K users / 6 months
  • 1 subscriber
  • 1.47K Posts
  • 32.2K Comments
  • Modlog