Article View: comp.sys.mac.programmer.codewarrior
Article #1115Re: unnamed namespaces in CW5.3
From: meeroh
Date: Wed, 24 Oct 2001 05:44
Date: Wed, 24 Oct 2001 05:44
45 lines
2154 bytes
2154 bytes
In article
<mjolnir_DELETE_-8A9595.23380323102001@east.usenetserver.com>,
Adin Hunter Baber <mjolnir_DELETE_@soltec.net> wrote:
>I was trying to put some classes in an unnamed namespace. The classes
>provide some extra functionality in that header, and don't need to be
>used outside of it. however, I am finding that I am able to create
>instances of these classes inside my main function.
>
>Is this an error in CW5.3? Is it fixed in CW7?
I think you misunderstand what the unnamed namespace is for. This is not
an error, as far as I know. The members of the unnamed namespace are
available throughout the compilation unit -- i.e. they will be available
in any cpp file which includes the header.
Perhaps if you show us how you are using class Stuff in the header file
we can suggest alternatives
hth
meeroh
>
>
>
>This compiles fine:
>
>file: somestuff.h
>namespace /*unnamed*/
> {
> class Stuff
> {...};
> }
>
>
>
>#include "somestuff.h"
>int main()
> {
> Stuff myStuff; // I don't think I should be able to do this
> return 0;
> };
--
Using random signatures is as simple as putting text files into a folder called "Random Signatures" in your Preferences folder.
Technical Details
Message-ID:
<macdev-854F03.01445224102001@senator-bedfellow.mit.edu>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!senator-bedfellow.mit.edu!dreaderd!not-for-mailReferences:
<mjolnir_DELETE_-8A9595.23380323102001@east.usenetserver.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bcce,426dc3c68e8241c3 X-Google-Attributes: gid10bcce,public X-Google-Thread: f635e,426dc3c68e8241c3 X-Google-Attributes: gidf635e,public X-Google-ArrivalTime: 2001-10-23 22:44:55 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!senator-bedfellow.mit.edu!dreaderd!not-for-mail From: meeroh <macdev@meeroh.org> Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac Mail-Copies-To: poster Subject: Re: unnamed namespaces in CW5.3 Organization: MIT References: <mjolnir_DELETE_-8A9595.23380323102001@east.usenetserver.com> User-Agent: MT-NewsWatcher/3.1 (PPC) Date: Wed, 24 Oct 2001 01:44:52 -0400 Message-ID: <macdev-854F03.01445224102001@senator-bedfellow.mit.edu> Lines: 45 NNTP-Posting-Host: NEON-20.MIT.EDU X-Trace: 1003902292 senator-bedfellow.mit.edu 1929 18.101.0.201