From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10705 invoked by alias); 3 Dec 2004 09:20:26 -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 10685 invoked from network); 3 Dec 2004 09:20:22 -0000 Received: from unknown (HELO mail2.codesourcery.com) (66.160.135.55) by sourceware.org with SMTP; 3 Dec 2004 09:20:22 -0000 Received: (qmail 8662 invoked from network); 3 Dec 2004 09:20:17 -0000 Received: from admin.voldemort.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.9) by mail2.codesourcery.com with SMTP; 3 Dec 2004 09:20:17 -0000 Received: (qmail 5838 invoked from network); 3 Dec 2004 09:20:16 -0000 Received: from localhost (HELO ?192.168.189.167?) (nathan@127.0.0.1) by mail.codesourcery.com with SMTP; 3 Dec 2004 09:20:16 -0000 Message-ID: <41B02FC9.3090404@codesourcery.com> Date: Fri, 03 Dec 2004 09:20:00 -0000 From: Nathan Sidwell Organization: Codesourcery LLC User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 MIME-Version: 1.0 To: Wei ZHANG CC: GCC Help Subject: Re: gcc question about the embedded type definitions References: <41B00D06.1050309@st.com> In-Reply-To: <41B00D06.1050309@st.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-12/txt/msg00033.txt.bz2 Wei ZHANG wrote: > Hi, > > I have a question on embedded type definitions. > > If in a structure definition, another type is defined. e.g. > > typedef struct S1 { > struct S2 { > int a; > } > } S1; > > is the data type S2 visible outside S1? Originally i think it is not > visible outside. in C it is visible, in C++ it is not. in C it declares a field of the outer struct, in C++ it declares a nested member. Your example is neither C not C++ though, as it is missing at least a semi colon. nathan -- Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk