C++ problems with RC1 - Mailing list pgsql-hackers

From teg@redhat.com (Trond Eivind Glomsrød)
Subject C++ problems with RC1
Date
Msg-id xuylmept3lm.fsf@halden.devel.redhat.com
Whole thread Raw
In response to RC1 finally wrapped ...  ("Marc G. Fournier" <scrappy@hub.org>)
Responses Re: C++ problems with RC1  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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.


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: pltcl build problem on FreeBSD (was: Re: pltlc and
Next
From: Bruce Momjian
Date:
Subject: Re: TODO items and their related files?