C ++ compilation preprocessing --- internal containment whistle and external containment whistle

In "Quality Programming Guide C ++ / c ", there is a brief introduction about internal inclusion of guards and external inclusion of guards.

But the author obviously overestimated my IQ. From the examples he cited, I still didn't understand the difference, and I didn't even know what it meant.

So I searched the Internet and found that most of them were the porters of the original author's code, as shown below:

 

 

 

For my damn understanding, well, look again, the result is still the same, I don't understand.

Fortunately, it ’s okay in the afternoon. I ’ll keep reading. Later, the author wrote it intentionally or unintentionally. With my damn understanding, I will do the following understanding first.

#if !defined(_INCLUDED_STDDEF_H_)
#include <stddef.h>
#define _INCLUDED_STDDEF_H_
#endif

Why is it called the internal containment whistle, just because his macro _INCLUDED_STDDEF_H_ is
defined between  #if! Defined and #endif .

The corresponding external containment whistle is defined after the macro definition is used, which is equivalent to being used first and defined.

 

#if !defined_STDDEF_H_INCLUDED_
#include <stddef.h>
#endif

 

Here I feel that the author    did not write _STDDEF_H_INCLUDED_ before this line of code, which is difficult to understand.

 

Please correct me if something is wrong, and rookie knelt again

 

Guess you like

Origin www.cnblogs.com/Jlord/p/12692994.html