M
Mark
Hello,
I was reading a coding style adopted in FreeBSD (and I believe in other
*BSD too) and here is what is said about using of 'typedefs':
"Avoid using typedefs for structure types.
....
Typedefs are difficult to use in stand-alone header files: the header
that defines the typedef must be included before the header that uses
it, or by the header that uses it (which causes namespace pollution), or
there must be a back-door mechanism for obtaining the typedef."
What is meant by stand-alone header files? I dont' quite understand the
hassle with including headers? We can declare incomplete type in a
header "a.h", and define the type in a source file "a.c". Then only
#include "a.h" and make use of the new defined type.
Or, what's more likely, I do not entirely understand this coding style
definitions.
I was reading a coding style adopted in FreeBSD (and I believe in other
*BSD too) and here is what is said about using of 'typedefs':
"Avoid using typedefs for structure types.
....
Typedefs are difficult to use in stand-alone header files: the header
that defines the typedef must be included before the header that uses
it, or by the header that uses it (which causes namespace pollution), or
there must be a back-door mechanism for obtaining the typedef."
What is meant by stand-alone header files? I dont' quite understand the
hassle with including headers? We can declare incomplete type in a
header "a.h", and define the type in a source file "a.c". Then only
#include "a.h" and make use of the new defined type.
Or, what's more likely, I do not entirely understand this coding style
definitions.