Re: just C++ in xcode
Re: just C++ in xcode
- Subject: Re: just C++ in xcode
- From: Joe Kurtz <email@hidden>
- Date: Fri, 30 Sep 2005 00:02:22 -0700 (PDT)
> wouldn't that obviate the whole
> namespace concept?
I sympathise with this statement. I was really looking
for a (named) "data repository" that I could use with
any code module simply by "using namespace n;"
With lots of variables, throwing extern at each one,
then defining each one again (in main.cpp, or
somewhere) is not as convenient as I had hoped.
--- Markian Hlynka <email@hidden> wrote:
> Lawrence is on the money as to the cause, I think.
> Sorry, I missed that!
>
> But, having to declare x as extern in the headers
> is, I think,
> unnesessary; wouldn't that obviate the whole
> namespace concept?
>
> I believe your namespace, as Lawrence says, should
> go in a .c file. I
> further believe that you shouldn't need a header
> file that has extern x.
>
> Um... do preprocessor include flags solve this?
> (what do you call
> these things again?) ie
>
> #ifndef MYFILE_H
> #define MYFILE_H
>
> ... contents of header file here
>
> #endif
> //end of header file
>
>
> On Sep 29, 2005, at 19:06, Lawrence Gold wrote:
>
> > On Sep 29, 2005, at 5:54 PM, Joe Kurtz wrote:
> >
> >
> >> Okay everyone, we're gettin' plenty of mileage
> from
> >> this. But there's just one thing I don't yet
> >> understand. I was pretty simplistic in my
> example. My
> >> code actually looks more like one of Andreas'
> >> examples:
> >>
> >> in foo1.h:
> >>
> >>
> >>> #include <iostream>
> >>>
> >>> namespace n { int x; };
> >>> void func();
> >>>
> >
> > You need to declare the variable extern in the
> header file and then
> > define it in ONE .c file. Remember that #include
> literally pastes
> > the text of the header file into the file
> including it, so every
> > file that includes foo1.h is defining a separate
> x.
> >
> > _______________________________________________
> > Do not post admin requests to the list. They will
> be ignored.
> > Xcode-users mailing list
> (email@hidden)
> > Help/Unsubscribe/Update your Subscription:
> >
>
>
> > 40cs.ualberta.ca
> >
> > This email sent to email@hidden
> >
>
> ----
> Quantum mechanics -- the dreams that stuff is made
> of.
>
>
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden