C++ problems with RC1

Trond Eivind Glomsrød <teg@redhat.com>

From: teg@redhat.com (Trond Eivind Glomsrød )
To: pgsql-hackers@postgresql.org
Date: 2002-01-23T16:49:09Z
Lists: pgsql-hackers
The autoconf test for C++ doesn't work with standard-enforcing
compilers....


[teg@halden teg]$ cat foo.C
#include <string>

int main(int argc, char **argv){
	string foo="xyzzy";
	return 0;
}
[teg@halden teg]$ c++ foo.C -o foo
foo.C: In function `int main(int, char**)':
foo.C:4: `string' undeclared (first use this function)
foo.C:4: (Each undeclared identifier is reported only once for each function it 
   appears in.)
foo.C:4: parse error before `=' token
[teg@halden teg]$

The standard mandates that string is accessed in one of the following
ways:

[teg@halden teg]$ cat foo2.C 
#include <string>

using namespace std;

int main(int argc, char **argv){
	string foo="xyzzy";
	return 0;
}
[teg@halden teg]$ cat foo3.C
#include <string>

int main(int argc, char **argv){
	std::string foo="xyzzy";
	return 0;
}
[teg@halden teg]$ 

Some compilers accept the old way (and namespaces have been available
for quite some time now), others (like upcoming gcc 3.1) don't.
-- 
Trond Eivind Glomsrød
Red Hat, Inc.