Subject: Some C++ (namespace, array assignment) questions
From: [email-masked] (Allan Peda)

20 Aug 1998 17:41:58 -0700
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
To: [email-masked]

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
"[email-masked]" with one line of text: "help".