GLBasic forum

Codesnippets => Inline / 3rd party => Topic started by: mentalthink on 2015-Aug-21

Title: Close GLbasic name space.
Post by: mentalthink on 2015-Aug-21
Hi guys I have a doubt because I don't understand too much the Inline Documentation (for the language not for the explanation).

When I use Inline, automatically namespace GLBasic is closed?¿, if not how I have to do for leave __GLBASIC__ without usefull.

I read something similar to this.

Inline
{ using name space __cplus_plus__


}namespace __GLBASIC__ // for turn again to GLbasic namespace.

thanks.
Title: Re: Close GLbasic name space.
Post by: kanonet on 2015-Aug-21
I dont understand your question, you already posted the answer. When you start INLINE you are still in namespace __GLBASIC__, if you want to leave it, you do so with simply writing }, if you are done with your stuff, you need to reopen the namespace before you call ENDINLINE. So it looks this way:
Code: (glbasic) [Select]
INLINE
} // closed namespace __GLBASIC__, you probably are in global namespace now

// do that stuff here, that you dont want to be inside GLBasic namespace

namespace __GLBASIC__ { // reopen GLBasic namespace
ENDINLINE
BTW you rarely need to do this, most INLINE stuff that you probably do, can savely be done inside GLBasic namespace. I usually just opend my own namespace inside __GBASIC__, which also works fine.
Title: Re: Close GLbasic name space.
Post by: mentalthink on 2015-Aug-21
Ok Kanonet thanks I don't know when you put "}" closed the namespace, I think you have to do something like closenamespace or use another...
I'm very newbie with C++

Thanks a lot for the clarify me.
 
Title: Re: Close GLbasic name space.
Post by: kanonet on 2015-Aug-21
What are you doing, that you need to close the namespace? Like I said, in most cases you can just use C++ code in INLINE without closing the namespace.
Title: Re: Close GLbasic name space.
Post by: mentalthink on 2015-Aug-21
Nothing interesting Kano, only is for learning.
I read in somebooks mix namespaces can be a bad practice  , how I comment I'm learning C++ (I'm not profesional programmer)  and is really interesting mix it with GLbasic.

Thanks again.