how does the compiler handle this ?
head1.h include head2.h
and head2.h include head1.h
but this way all is ok ,so how does the compler handle this ?
include guards
Everything between the #ifndef and the #endif will only be included once.
#ifndef __SOME_COOL_NAME#define __SOME_COOL_NAME// ...#endif
Everything between the #ifndef and the #endif will only be included once.
And if you don't have the include guards, then the compiler will give an error after a certain depth (around 100 recursions sounds sensible)
Hm, after giving this a second thought, I think the compiler does not handle this it all - the preprocessor does.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement