Some C++ (namespace, array assignment) questions
Allan Peda
allan@interport.net
Thu Aug 20 01:51:00 GMT 1998
I am learning C++, and have the 1997 Stroustrup book. My compiler
(gcc 2.7.2.3) warns on Stroustrup's code
that namespaces are broken in that release of gcc. As in:
#include <iostream>
using namespace std;
int main(void)
{
cout << blah << endl;
return(0);
}
Does egcs support namespaces?
Also... I can reassign string constants?! Here:
$ make stringy
g++ -O -pedantic -Wall -ansi stringy.C /usr/lib/libstdc++.a -o
stringy
stringy.C: In function `int main()':
stringy.C:7: warning: ANSI C++ forbids assignment of arrays
[allan@scooby allan]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/specs
gcc version 2.7.2.3
[allan@scooby allan]$ cat stringy.C
#include<iostream.h>
int main(void)
{
char datarr[5]="bits";
cout << datarr << endl;
datarr = "byte";
cout << datarr << endl;
return(0);
}
[allan@scooby allan]$
At worst generates a warning with -ansi -Wall -pedantic
Why?
Thanks
Allan
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".
More information about the Cygwin
mailing list