Is it bad practice to put #endif
at the beginning of a c++ header file after #ifndef
and #define
? If so, why?
This question does not touch on why #endif
is at the end - which is specifically what i was googling for.
For example
//cDate.h
#ifndef CDATE_H_EXISTS
#define CDATE_H_EXISTS
#include <string>
class cDate {
private:
std::string day;
std::string month;
std::string year;
public:
void setDate(std::string, std::string, std::string);
std::string getDate(int);
}; // end class def
#endif
vs
//cDate.h
#ifndef CDATE_H_EXISTS
#define CDATE_H_EXISTS
#endif
#include <string>
class cDate {
private:
std::string day;
std::string month;
std::string year;
public:
void setDate(std::string, std::string, std::string);
std::string getDate(int);
}; // end class def