Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!ispd-newsserver!kodak!islsun!cok From: cok@islsun.Kodak.COM (David Cok) Newsgroups: comp.std.c++ Subject: Re: type/member tags Message-ID: <1991Mar12.123811.13701@kodak.kodak.com> Date: 12 Mar 91 12:38:11 GMT References: <1399@culhua.prg.ox.ac.uk> <27D3E544.619A@tct.uucp> <4338@lupine.NCD.COM> Sender: cok@Kodak.COM Organization: Eastman Kodak Co., Rochester, NY Lines: 31 In article <4338@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: >In article <27D3E544.619A@tct.uucp> chip@tct.uucp (Chip Salzenberg) writes: >+According to bill@robots.oxford.ac.uk (Bill Triggs): >+>Creation of an instance of an implicitly specified class.... >+>It seems that an appropriately global `class-designator' is >+>indispensable for this, whether string or global address or >+>global enumeration constant ... >+ >+The class name is already guaranteed to be unique (name equivalence >+and all that). What need of more? > >Not only are file-scope class names not guaranteed to be unique across >multiple independent compilation units (which may later be combined to >form a single program) but class names need not even be unique *within* >a single compilation unit. (Remember that any given compilation unit may >contain numerous independent declarative scopes.) >-- I agree that class names can be reused in local scopes within functions and other classes. But can they be reused at file scope in different compilation units? I thought these were effectively global, as free functions are. If you try this with Sun C++ (and the classes happen to have non-inline functions with the same name and parameter types) you will get a link error with a multiply defined function error. Not to necessarily advocate the use of a class name as a type tag, but it seems that it would work, with suitable mangling for local scopes, if one wanted to do it. David R. Cok Eastman Kodak Co. cok@Kodak.COM