c++/6257: C-library symbols enter global namespace
marc-oliver.gewaltig@hre-ftr.f.rd.honda.co.jp
marc-oliver.gewaltig@hre-ftr.f.rd.honda.co.jp
Thu Apr 11 09:26:00 GMT 2002
>Number: 6257
>Category: c++
>Synopsis: C-library symbols enter global namespace
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 11 09:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: marc-oliver.gewaltig@hre-ftr.f.rd.honda.co.jp
>Release: unknown-1.0
>Organization:
>Environment:
Linux (Suse 6.2), Solaris 8, probably all
>Description:
The C++ standard states that
- all C++ header files define their symbols in namespace std
- all C header files, used in the form <c*> define their symbol in
namespace std (Annex D 5.2,3).
However, g++ puts C symbols in the global namespace,
even if included via <c**> headers.
>How-To-Repeat:
The following version of hello-world should NOT compile
with an ISO-14882 compliant compiler
#include <cstdio>
int main()
{
// should not work, because printf is in std::
printf("Hello world.\n");
return 0;
}
>Fix:
Put all C symbols in the namespace std, if included
by <c*> headers.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list