Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How about diamond shape header files relationship

55 views
Skip to first unread message

fl

unread,
Nov 1, 2017, 7:36:52 PM11/1/17
to
Hi,

I know there could be some problems for a diamond type classes inheritance. It
is talked about on some C++ books. Recently, when I learn a C++ program, which
is relatively big in my view, I see its header files legend shows a diamond
shape including relationship. As I know these header files have some class
definitions inside. Though header file 'include' is different from class
inheritance, there could be some problems for a diamond including relationship
for header files?


Thanks,

Paavo Helde

unread,
Nov 2, 2017, 1:56:41 AM11/2/17
to
No problems, assuming that the header files have proper include guards
or #pragma once.

The #include mechanism is just a way to prepare a fully linear source
text for a translation unit, and include guards are a trick to avoid
duplications or infinite recursion during this process. Any diamond
shape include relations effectively just get flattened out by this process.


0 new messages