Re: [boost] [serialization] new STATIC_ASSERTION_FAILURE

----Original Message---- From: Robert Ramey [mailto:ramey@rrsd.com] Sent: 23 June 2005 17:07 To: boost@lists.boost.org Subject: Re: [boost] [serialization] new STATIC_ASSERTION_FAILURE
Vladimir Prus wrote:
"all #includes from the boost/archive directory should preceed all #includes from the serialization directory."
This rule means that I can't include <boost/serialization/base_object.hpp> in my headers, and then in my cpp file first include my headers and then archive headers. And I do want to include my header first in .cpp, in order to detect any missing includes in the header itself.
I don't really understand this.
Many people (myself included) have a rule that header files are self contained. If you need something in the header file, you #include the header and that is all you have to do. To police this, and to make sure that the program is not compiling "by accident" because every current occurance of the header happens to be preceded by the required headers, the standard form of a file xxx.cpp in my projects is: #include "universal.h" // Absolutely standard includes that would be // boring to include in every header - like windows.h #include "xxx.h" // Prove that xxx.h is self contained. Some people have an even stronger form of the rule without the universal.h - they will have a REAL problem with requiring an order of includes. I read your explanation of why you have the requirement on the order of includes, and it seems to buy some advantages for some people (but not all). It *is* quite a high cost though; not having used serialization, I can't say whether it is worth it. -- Martin Bonner Martin.Bonner@Pitechnology.com Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 441434

Martin Bonner <martin.bonner@pitechnology.com> writes:
----Original Message---- From: Robert Ramey [mailto:ramey@rrsd.com] Sent: 23 June 2005 17:07 To: boost@lists.boost.org Subject: Re: [boost] [serialization] new STATIC_ASSERTION_FAILURE
Vladimir Prus wrote:
"all #includes from the boost/archive directory should preceed all #includes from the serialization directory."
This rule means that I can't include <boost/serialization/base_object.hpp> in my headers, and then in my cpp file first include my headers and then archive headers. And I do want to include my header first in .cpp, in order to detect any missing includes in the header itself.
I don't really understand this.
Many people (myself included) have a rule that header files are self contained. If you need something in the header file, you #include the header and that is all you have to do. To police this, and to make sure that the program is not compiling "by accident" because every current occurance of the header happens to be preceded by the required headers, the standard form of a file xxx.cpp in my projects is: #include "universal.h" // Absolutely standard includes that would be // boring to include in every header - like windows.h #include "xxx.h" // Prove that xxx.h is self contained.
Some people have an even stronger form of the rule without the universal.h - they will have a REAL problem with requiring an order of includes.
I read your explanation of why you have the requirement on the order of includes, and it seems to buy some advantages for some people (but not all). It *is* quite a high cost though; not having used serialization, I can't say whether it is worth it.
Even if you don't like that technique, in a world with headers including other headers, #include order is notoriously hard to control and maintain. Any design that relies on it is fragile. I know this from personal experience because Python has such a rule and it messes up my Boost.Python developers all the time. Incidentally, I believe Python's rule is imposed on it by POSIX :( -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
Martin Bonner