namespace issues with old C headers

Gabriel Dos Reis gdr@integrable-solutions.net
Sat Apr 12 18:52:00 GMT 2003


David Schultz <das@freebsd.org> writes:

| On Sat, Apr 12, 2003, Gabriel Dos Reis wrote:
| > David Schultz <das@FreeBSD.ORG> writes:
| > | sure why it is problematic.  In C, it is actually required that
| > | standard headers not pollute the namespace with symbols from other
| > | headers, lest standard C programs fail to compile.  Perhaps C++
| > | differs in this regard, but that doesn't explain why this idea is
| > | ``unrealistic.''
| > 
| > C++ definitely has a different requirement:  It allows a standard
| > header (not a C-iniherited one) to include another standard header.
| > And in effect, if a standard function implementation needs to use
| > (reasonably) another stanadrd function, I don't see why it should not
| > be permitted to include the appropriate header. 
| 
| Avoiding namespace pollution is somewhat helpful for application

#includeing standard headers does not pollute library and application
 programmers' namespace -- since the only namespace that gets "affected"
is ::std -- so I can't see what you're driving at.

| writers because they don't need to worry about leaving out an
| include such that their program still compiles with one C++
| library but not another.  But if the standard is silent on the
| issue and you would like to avoid the added complexity, I can't
| really argue.

The standard isn't silent: It explicitly says that a standard header
can include another standard header.

| > | In any case, you have shot down all of my proposed solutions,
| > 
| > The intent wasn't to shut down all of your proposed solutions.
| > I'm more interested in a "real" solution and none of what you proposed
| > seems to address the real problem.  I see Loren is working a
| > patch that might give real solution.
| 
| I agree that none of my proposals were perfect;

I'm making a distinction between "perfect" and "real solutions".
As I said, none of what you proposed really solved the problem.
I'm not speaking of "perfection", it is something on cares about when one
has a choice.

-- Gaby



More information about the Libstdc++ mailing list