Is there a recommended practice that for example global includes shall go befor local includes. By global I mean #include <iostream>
and local #include "myhdr.h"
. Is it some prefered order and why?
Yes, there are recommendations. Some of them are:
#inlcude <>
for C and STL and #include ""
for your own headers.They should look something like this:
#include "MyClass.h"
#include <time.h>
#include <iostream>
#include <vector>
#include "MyFolder/MyAwesomeClass.h"
#include "MyOtherFolder/MyOtherClass.h"
For more recommendations on good coding style you can take a look at Google's C++ Style Guide. They give a good explanation on why you should do this in this section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With