Who needs to be a good example to students?[C++]
//So This is the story of the inclusions of the header files in a first year comp sci assignment
//The class isn't bad, but sometimes it produces... "questionable" code examples, I saw a malloc once.
//This is in main.cpp, so, lets see how it goes.
//So we've got two custom headers here, all's good right?
#include "state.h"
#include "output.h"
//lets see whats in these headers
//state.h
#include <cstdlib>
#include <iostream>
#include <vector>
#include "common.h"
#include "bot1.h"
#include "outstream.h"
//well... that's not great, you really shouldn't be including headers in headers but... you've got header guards for that right?
//output.h
#include "state.h"
//Wait.....
//outstream.h
#include <streambuf>
#include <iostream>
#include <vector>
//So that's a little bit of redundant inclusion...
//bot1.h
#include <vector>
#include <iostream>
//Oh fuck you
//This wasn't even the worst of it, the files were a mess of including includes in includes
//I was able to comment out ten lines of includes without affecting anything
//Who needs to be smart about includes when you have header guards?
Posted Nov 25, 2016, 2:57 AM UTC
018