[libdvbpsi-devel] Header multiple inclusion error

Andrey Utkin andrey.krieger.utkin at gmail.com
Tue May 14 13:46:42 CEST 2013


2013/5/14 Jean-Paul Saman <jpsaman at videolan.org>:
> In case of multiple inclusion of a header file is usually a sign that the
> design is flawed.
> Your design probably exposes more internal details than it needs too.
>
> It could easily lead to circular dependencies. It is cleaner to have header
> files as much
> as possible declared inside the *.c file.
>
> This is my 2cts on the subject.
>
>> And with workaround you gave, i see the problem of having type
>> dvbpsi_t undefined in headers. As i explained, i need this type as
>> classes datamembers.

It feels like you ignore what i say.
Your point is very valid for C, but I have C++ project, not C. It is
usual to declare fully the object structure in .h file, and private
data members, too, you know. Well, as far as i know, there's no way at
all to _not_ declare private datamembers in .h and declare them later
in .cpp of that same class.
And the classes i address to are not of public API, they're just
classes inside my project, i don't want to use PIMPL pattern or
something else, splitting classes into two _only_ to workaround the
compilation fail forced by library.

I'd say it again - i am not against include guard as such, i am for
removal of compilation fail forcing. It is not used anywhere else!
Look at include guarding in other projects, they don't have it. Look
at wiki, there's no even mention of such behaviour, everywhere it is
just
#ifndef HEADER_H_
#define HEADER_H_
// declarations
#endif

--
Andrey Utkin


More information about the libdvbpsi-devel mailing list