
When I build the serialization library I get two copies of the diagnostic message. I asked this before but now I can't find the answer. It seems that it was suggested that this was symptom of some sort of mistake that could/should be corrected. In studying this I've come upon the following scenario. library ab contains a.cpp - with interface in a.hpp b.cpp - with interface in b.hpp User programs might contain a.hpp or b.hpp or both depending on what they want to call. So each of a.hpp and b.hpp should contain auto-link to generate the pragma corresponding to the library ab. However if, it the user includes both a.hpp and b.hpp - which he gets two diagnostic messages - since auto_link.hpp has no include guard. If this is a mistake, where is it and who is making it? Robert Ramey

Robert Ramey wrote:
When I build the serialization library I get two copies of the diagnostic message.
I asked this before but now I can't find the answer. It seems that it was suggested that this was symptom of some sort of mistake that could/should be corrected. In studying this I've come upon the following scenario.
library ab contains
a.cpp - with interface in a.hpp b.cpp - with interface in b.hpp
User programs might contain a.hpp or b.hpp or both depending on what they want to call. So each of a.hpp and b.hpp should contain auto-link to generate the pragma corresponding to the library ab. However if, it the user includes both a.hpp and b.hpp - which he gets two diagnostic messages - since auto_link.hpp has no include guard. If this is a mistake, where is it and who is making it?
Well I'd say it's a mistake of the author of a.hpp and b.hpp. From looking at the thread version of autolink it uses a common header for doing the configuration. That config header, which includes the autolink header, is guarded. Hence you get only one message. I don't see this in the autolink author guidelines though. The rationale for autolink.hpp not being guarded is of course that it needs to be included multiple times. In the same way that some of the Boost.PP headers work. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com -- 102708583/icq - grafikrobot/aim - grafikrobot/yahoo

Hmmm - but why is it a mistake? Robert Ramey Rene Rivera wrote:
Robert Ramey wrote:
When I build the serialization library I get two copies of the diagnostic message.
I asked this before but now I can't find the answer. It seems that it was suggested that this was symptom of some sort of mistake that could/should be corrected. In studying this I've come upon the following scenario.
library ab contains
a.cpp - with interface in a.hpp b.cpp - with interface in b.hpp
User programs might contain a.hpp or b.hpp or both depending on what they want to call. So each of a.hpp and b.hpp should contain auto-link to generate the pragma corresponding to the library ab. However if, it the user includes both a.hpp and b.hpp - which he gets two diagnostic messages - since auto_link.hpp has no include guard. If this is a mistake, where is it and who is making it?
Well I'd say it's a mistake of the author of a.hpp and b.hpp. From looking at the thread version of autolink it uses a common header for doing the configuration. That config header, which includes the autolink header, is guarded. Hence you get only one message. I don't see this in the autolink author guidelines though.
The rationale for autolink.hpp not being guarded is of course that it needs to be included multiple times. In the same way that some of the Boost.PP headers work.

Robert Ramey wrote:
Hmmm - but why is it a mistake?
Well it's harmless, but basically the auto-link header *cannot* be include guarded because it really does have to be included multiple times, albeit normally for different libraries. So if you include it multiple times for the same lib, you will - if you have diagnostic messages turned on - get two messages rather than one. But that's it, other than that it's harmless. To prevent the multiple diagnostics just add your own include serialisation-specific guard around it: #ifndef BOOST_SERIALISATION_AUTO_LINKED #define BOOST_SERIALISATION_AUTO_LINKED // auto line setup goes here #endif and repeat in all the places where you need it. Or factor out into a separate header of course. John.
participants (3)
-
John Maddock
-
Rene Rivera
-
Robert Ramey