Linked by Eugenia Loli-Queru on Mon 6th Mar 2006 02:02 UTC
General Development Did you know that there are three different C++ namespace types? Namespaces, which are simple to learn and apply, offer a clever means of packaging your code and can assist when symbol conflicts occur. And how well does your code handle exceptions? Inserting exception-handling code can make your code more ready for packaging as external functions. Stephen Morris contends that just as namespaces offer an efficient way to package code, the skillful use of exception handling can quickly simplify that code.
Thread beginning with comment 101824
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: Namespaces
by jonathan on Mon 6th Mar 2006 17:14 UTC in reply to "RE: Namespaces"
jonathan
Member since:
2006-02-10

I try to avoid the using statement too so I can see all the time where a class comes from. But I wasn't using it for classes within the same namespace, of course. Still, I didn't like it much.

I know I don't have to indent everything, but the code formatter to. I guess I just don't like C++' syntax. The following would have been a nicer way to write:

class ns::Classname
{
};

Forward decarations to different namespaces are ugly too.

namespace nsa
{
....class ClassA;
}

namespace nsb
{
....class ClassB
....{
........nsa::ClassA* m_a;
....}
}

alternatively. better or worse?

namespace nsb
{
class ClassB
{
....nsa::ClassA* m_a;
}
}

It seems like I am a C++ hater but maybe I am back to namespaces again next week. By the way, the D language has a much nicer syntax than C++, but I have not tried it yet.

Reply Parent Bookmark Score: 2