Newsgroups: comp.lang.c++
Path: utzoo!censor!geac!alias!barney!rae
From: Reid Ellis <rae@gpu.utcs.toronto.edu>
Subject: Re: Naming nested declarations
Message-ID: <rae.665217460@barney>
Sender: Reid Ellis <rae%alias@csri.toronto.edu>
Reply-To: Reid Ellis <rae@gpu.utcs.toronto.edu>
Organization: Alias Research, Inc. Toronto ON Canada
References: <98561@aerospace.AERO.ORG>
Date: 30 Jan 91 06:37:40 GMT

In <98561@aerospace.AERO.ORG> jordan@aerospace.aero.org (Larry M. Jordan) writes:
>  struct NODE {
>    ...
>    union ninfo {
>      ...
>    } n_info;
>  };
>
>which of the following is "correct"?
>
>  [1] int i = sizeof(NODE::ninfo);
>
>  [2] int i = sizeof(union ninfo);

Well, ARM says [1] is correct, but not a lot of compilers have
implemented nested types yet, so you'd be taking your chances to use
them right now.  You might be best off for now using an #ifdef like

#ifdef OLD_cplusplus
	int i = sizeof(ninfo);	// you don't need an explicit "union",
				// do you?
#else
	int i = sizeof(NODE::ninfo);
#endif

					Reid
--
Reid Ellis  176 Brookbanks Drive, Toronto ON, M3A 2T5 Canada
rae@gpu.utcs.toronto.edu      ||  rae%alias@csri.toronto.edu
CDA0610@applelink.apple.com   ||             +1 416 446 1644
