Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!mips!bridge2!jarthur!uunet!mcsun!ukc!dcl-cs!aber-cs!pcg From: pcg@aber-cs.UUCP (Piercarlo Grandi) Newsgroups: comp.lang.c++ Subject: Re: Local classes, are they worth it???? Summary: Local classes have a very restrictive definition. OK! Message-ID: <1661@aber-cs.UUCP> Date: 22 Feb 90 16:31:51 GMT Reply-To: pcg@cs.aber.ac.uk (Piercarlo Grandi) Organization: Dept of CS, UCW Aberystwyth (Disclaimer: my statements are purely personal) Lines: 17 In article <58170004@hpcll05.HP.COM> pfaust@hpcll05.HP.COM (Paul Faust) writes: Local classes with the combination of the +d option give the illusion of Pascal style nested functions. In cfront, if a local class defines member functions (with their bodies), the +d option will cause the function to dumped out prior to the definition of the function currently being processed. Static members are properly hoisted out. However, locals that are defined prior to the class are not accessible and cfront generates an error. Reading Lippman on this subject makes it clear that local classes have been officially burdened with enough restrictions to the effect that they don't really implement a nested scope. This is appropriate -- you don;t really want to have nested scopes in a language supposedly compatibl with C... -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk