|
Boost : |
From: John Max Skaller (skaller_at_[hidden])
Date: 2001-05-20 16:21:43
Daryle Walker wrote:
>
> You mean 2.95 for your GCC version, right?
Yes.
> I don't think conformance in the way you're thinking of is possible with
> today's technology. I think all #includes work today by text dumps, so a
> header that includes another header has to "leak" the symbols from the inner
> #include. You should ignore that effect and directly #include the headers
> for any symbol you directly use.
That isn't the case for macros: they can, and should, be
#undef'd inside the header that uses them.
For types, the solution is to use implementor space
symbols: it doesn't matter if they leak. Same for functions.
So it is certainly possible with todays technology,
and it is _required_ :-)
> Since <cassert> is supposed to help with user debugging, why would any
> standard header #include it?
So inline functions can assert. But assert should be
#undef'd at the end of the file if it was created by an inner include.
#ifdef assert
#define assert_defined
#else
#include <assert.h>
#endif
...
#ifndef assert_defined
#undef assert
#endif
This doesn't work if a non-standard assert is already defined,
but that would get crunched by an 'inner' assert anyhow.
A better technique is to use a vendor extension. :-)
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk