|
Boost : |
From: John Maddock (John_Maddock_at_[hidden])
Date: 1999-09-28 06:49:15
I wonder if it is worth while having a standard policy to deal with the old
C style headers, the problem is that while most current compilers ship with
the <cname> header variants, not all of them place the contents in
namespace std. There would appear to be three workarounds:
1) Always use the <name.h> approach - the primary advantage is that this
always works, but pollutes the global namespace.
2) Use the <cname> version along with the workaround:
#include <cname>
namespace std{} // dummy in case not alway defined
namespace boost{ namespace internal{
using namespace std;
/* code goes here */
}
}
3) use the <cname> version along with a macro BOOST_STDC which is defined
to either <nothing> or std depending upon the compiler:
#include <cname>
namespace boost{ namespace internal{
// here we can refer to BOOST_STDC::cfunction etc
/* code goes here */
}
}
Option (2) is probably the easiest for .cpp files but I don't fancy it in
headers (for template code for example), which leaves option (3), any
thoughts?
Thanks,
John Maddock.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk