libstdc++/3054: string.h conditionally wrapped in namespace std

kreckel@ginac.de kreckel@ginac.de
Tue Jun 5 08:36:00 GMT 2001


>Number:         3054
>Category:       libstdc++
>Synopsis:       string.h conditionally wrapped in namespace std
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          mistaken
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 05 08:36:20 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Richard Kreckel
>Release:        gcc version 3.0 20010605 (prerelease)
>Organization:
>Environment:
Debian GNU/Linux potato on i386
>Description:
It seems like the depr.c.header string.h is sometimes 
(but not always) wrapped inside namespace std.  This should
always happen to the cstring header, but never to string.h,
according to ISO/IEC 14882:1998, Annex D, secton 5.  This
code does not compile, thus exhibiting the problem:

#include <iostream>
#include <string.h>

int main(void)
{
	const char * a = "ll";
	const char * b = "hello";
	if (::strcmp(a,b))  // changing to std::strcmp works.
		printf("yes\n");
	else
		printf("no\n");
	return 0;
}

Also, I noted that reversing the two include directives seems 
to fix the problem.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list