c problem
in stdio.h the first two lines are :
#ifndef _STDIO_H_
#define _STDIO_H_
these i suppose are so that we can include it several times in our c project which has 2 or more .c files and which include stdio.h
but what is the significance of _STDIO_H_ ( why this strange name )
There is no significance. You can name that Macro whatever you like, just as long as its unique. Using the filename of the header as the macro is one way to be unique.
there is no significance, it just has to be unique - with any luck _STDIO_H_ wouldn't be used as a variable or function name. It could be
_BAA_BAA_BLACK_SHEEP_HASNT_ANY_WOOL__H_
and still work....
_BAA_BAA_BLACK_SHEEP_HASNT_ANY_WOOL__H_
and still work....
ok ,
but still is the first underscore of _STDIO_H_
related to being a global variable or something like that?
but still is the first underscore of _STDIO_H_
related to being a global variable or something like that?
The first underscore is probably just there to make it less likely that the same identifier is used somewhere else. When people say that there is no significance to the name, they mean that there really is no significance to the name.
On Underscores
What that means is that the compiler can use leading underscores as often as they'd like to limit the odds that you, the user of the compiler, will not have any conflicts provided that you yourself don't use leading underscores. So if there is any significance that is probably it. I don't believe either C nor C++ standard dictates a particular naming convention for standard library header guards.
Quote:From the article
This practice was later codified as part of the C and C++ language standards, in which the use of leading underscores was reserved for the implementation.
What that means is that the compiler can use leading underscores as often as they'd like to limit the odds that you, the user of the compiler, will not have any conflicts provided that you yourself don't use leading underscores. So if there is any significance that is probably it. I don't believe either C nor C++ standard dictates a particular naming convention for standard library header guards.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement