delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/08/20/17:41:58

From: allan AT interport DOT net (Allan Peda)
Subject: Some C++ (namespace, array assignment) questions
20 Aug 1998 17:41:58 -0700 :
Message-ID: <35DA4127.1C2B9C3.cygnus.gnu-win32@interport.net>
References: <9808150630 DOT aa17386 AT morticia DOT arl DOT mil>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

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 AT 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 AT 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 AT 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 AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019