Xref: utzoo comp.lang.c++:6429 gnu.g++:648 gnu.g++.bug:1444 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!milano!cadillac!pebbles!ned From: ned@pebbles.cad.mcc.com (Ned Nowotny) Newsgroups: comp.lang.c++,gnu.g++,gnu.g++.bug Subject: Re: Typedefs in class declarations. Keywords: typedef class Message-ID: <6038@cadillac.CAD.MCC.COM> Date: 12 Feb 90 04:07:59 GMT References: <6016@cadillac.CAD.MCC.COM> <25D3DCB8.16923@paris.ics.uci.edu> Sender: news@cadillac.CAD.MCC.COM Reply-To: ned%cad@MCC.COM (Ned Nowotny) Organization: MCC CAD Program, Austin, TX Lines: 32 In article <25D3DCB8.16923@paris.ics.uci.edu> rfg@ics.uci.edu (Ronald Guilmette) writes: =>In article <6016@cadillac.CAD.MCC.COM> ned@MCC.COM (Ned Nowotny) writes: =>>...[ I question the way G++ handles typedefs within a class declaration ]... => =>Currently, g++ treats class-nested typedefs as local to the containing =>class. This is certainly different from what cfront 2.0 currently does. =>Whether it is a problem or not depends on what you are trying to do. =>Little incompatabilities like this are always mildly irritating however. => =>...[ Ron reports MDT's opinion on this issue ]... => =>>I do know, however, that you =>>can't declare something as a classname::typedef. Therefore, it would seem that =>>G++'s behavior is either a bug, or typedefs within class declarations are =>>nearly useless. => =>They may be useful within the class. Think encapsulation! => Now, I may just be ignorant, but it seems to me that encapsulation should mean that a private member function of a class could be declared and defined to return a type named by a typedef declared within a class declaration. However, G++ will not even allow this. (For an example, look at the parseDate function declared in Date.h and defined in Date.c in the NIH Class Library.) This variance from both C++ and ANSI C behavior seems unnecessary and, perhaps, incorrectly implemented. Ned Nowotny, MCC CAD Program, Box 200195, Austin, TX 78720 Ph: (512) 338-3715 ARPA: ned@mcc.com UUCP: ...!cs.utexas.edu!milano!cadillac!ned ------------------------------------------------------------------------------- "We have ways to make you scream." - Intel advertisement in the June 1989 DDJ.