Why are Header Guards names in capital and with underscore?

I noticed that .h files have their name capitalized and uses underscore for header guards....why is that?

for example take "doThat.h"

the header guard would be:
#ifndef DO_THAT_H
#define DO_THAT_H


why is it capitalized and underscored like that? even if in the main.cpp you only type #include "doThat.h" to use the file?? There is some real programing reason to this? why not just type :

#ifndef doThat.h
#define doThat.h
Last edited on
All caps traditionally is used for macros (defines) so that there's less chance of a name conflict.

You are more likely to have a variable named doThat in your program than you are to have a variable named DO_THAT_H_INCLUDED.

Macro name conflicts cause bizarre errors
Topic archived. No new replies allowed.