I've been learning C recently, and in one of my textbooks I found a reference to a file with the ".r" extension. Now, as you can imagine, googling "r" or "file extension r" is not productive, so I wonder if you could help me out.
It appears in the following code block
#include "new.r"
static const struct Class _String = {
sizeof(struct String),
String_ctor, String_dtor,
String_clone, String_differ
};
const void * String = & _String;
The author mentions that it is a "private header", but I wish he could have been more clear as to what exactly that is.
Public headers are those needed by the users of the library. Private headers are those needed to compile the library, but which are not needed by library users.
In C language, header files contain the set of predefined standard library functions. You request to use a header file in your program by including it with the C preprocessing directive “#include”. All the header file have a '. h' an extension. By including a header file, we can use its contents in our program.
header files are simply files in which you can declare your own functions that you can use in your main program or these can be used while writing large C programs. NOTE:Header files generally contain definitions of data types, function prototypes and C preprocessor commands.
As far as I can tell from various open source projects I've seen, private headers are headers intended to be used only by a particular piece of code (a file or multiple files). They are useful when, for example, some files need access to each other's symbols/declarations, but those symbols/declarations shouldn't be accessed from other code. Or they can be used to split prototypes out of .c files.
Global or normal headers are usually stored in a special 'include' directory, while private headers stay near the specific code they serve.
As for the 'dot r' extension, I've never heard of it before. The private headers I've seen are named 'dot h', like all others.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With