From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28076 invoked by alias); 27 Apr 2004 14:33:49 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 28067 invoked from network); 27 Apr 2004 14:33:47 -0000 Received: from unknown (HELO mgr2.xmission.com) (198.60.22.202) by sources.redhat.com with SMTP; 27 Apr 2004 14:33:47 -0000 Received: from [198.60.22.201] (helo=mgr1.xmission.com) by mgr2.xmission.com with esmtp (Exim 3.35 #1) id 1BITeb-0007FO-02; Tue, 27 Apr 2004 08:33:45 -0600 Received: from [198.60.22.20] (helo=xmission.xmission.com) by mgr1.xmission.com with esmtp (Exim 4.30) id 1BITea-000635-S5; Tue, 27 Apr 2004 08:33:44 -0600 Received: from llewelly by xmission.xmission.com with local (Exim 3.35 #1 (Debian)) id 1BITea-0008B0-00; Tue, 27 Apr 2004 08:33:44 -0600 To: "Luu Vo" Cc: References: <001d01c42c38$0582b7a0$cc62a8c0@LuuVo> From: llewelly@xmission.com Date: Tue, 27 Apr 2004 14:33:00 -0000 In-Reply-To: <001d01c42c38$0582b7a0$cc62a8c0@LuuVo> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 MIME-Version: 1.0 Subject: Re: extern C and static data type problem with g++ Content-Type: text/plain; charset=us-ascii X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on mgr1.xmission.com X-Spam-Level: X-Spam-Status: No, hits=0.3 required=8.0 tests=NO_REAL_NAME autolearn=no version=2.63 X-SA-Exim-Mail-From: llewelly@xmission.com X-SA-Exim-Version: 3.1 (built Wed Aug 20 09:38:54 PDT 2003) X-SA-Exim-Scanned: Yes X-SW-Source: 2004-04/txt/msg00360.txt.bz2 "Luu Vo" writes: > In RH Linux 9, when compiling my C++ program with lines as below: > > extern "C" struct {int x}; > static enum E{A=0, B, C}; extern "C" { struct x {int x;}; enum e{a= 0, b, c}; } > > g++ said: > > storage class specified for field `x' Maybe the gcc 3.4 diagnostic is better: extrn.cc:3: error: ISO C++ prohibits anonymous structs > `static' can only be specified for objects and functions > > Is this just the implementation of g++? It is required by the ISO C++ standard. > That means I can't use static and > extern "C" for those lines of code? > > Another question: with GNU g++/gcc compiler and its C++ library, can I use > both traditional C++ lib (e.g., classic iostream) and standard C++ lib > (e.g., standard iostream) in my C++ program. Any code which uses classic iostreams should be updated to use standard iostreams. GCC >= 3.0 does not support classic iostreams. "iostream.h" is just: #include "backward_warning.h" #include and some appropriate using declarations. For simple cases this is backward-compatible with classic iostreams, but in some cases it is not. So if you tried to use 'both' you would really be using the same iostreams in both places. > Are the both libraries > implemented in glibstdc++? No.