
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.