I heard that you prefer to write internal rather than external external guards.
I searched on the Internet but could not find an answer to it.
This is a fragment of the book "C ++ Coding Standards" by Herb and Andrew, which shows the "external guard":
Avoid using outdated external security guards protected by older books:
#ifndef FOO_HJNCLUDED_
#include "foo.h"
#define FOO_HJNCLUDED_
#endif
Now this leads to the following question:
Q:
What is an internal guard and an external guard? What is the difference between the two, and why do the internal ones include guards? I would like this answer to also give an example.
Edit: I ended up answering my question.
source
share