gtorrent / gtorrent-core

Core library of gTorrent which handles everything but UI/UX
GNU General Public License v3.0
39 stars 12 forks source link

include dont redefine #98

Closed benwaffle closed 9 years ago

nyanpasu commented 9 years ago

That's not a fucking redefinition. It's forward declaration, so that we don't include more fucking bullshit in header files. I made the changes in ae8c1440

You can read more about forward declarations here

benwaffle commented 9 years ago

its a struct, not a class

the API may change

Is your computer to slow to handle include files?

nyanpasu commented 9 years ago

Yes. I'm sure it is on yours too. Putting any sort of unnecessary #includes in header files is just poor taste. If you include in header files, when the compiler parses any files that includes this header file, everything inside this header file will be included, and whatever is included in the headers that header included is also included. It's a huge clusterfuck. Header guards just tell the compiler to discard the contents of a header, but it still has to go through the whole thing.

In header files, all you need to know is what you're defining. You don't need to #include entire files when all the header file is trying to tell you is essentially "This functions will require these arguments, some of which are types we don't know"

You don't need to get the implementation of the types/classes, you just need the names. The *.cpp files are responsible for retrieving the actual code.