I'd like to know why the mbed library don't use namespaces?

11 Oct 2010

Hi all.

I'd like to know why the mbed library don't use namespaces?

Some Japanese people would like to know it.

Thanks

Shin. :)

11 Oct 2010

I'll ask another question: why would you use namespaces in mbed library? What problems would it solve?

11 Oct 2010 . Edited: 11 Oct 2010

Dear Mr.Igor Skochinsky-san

Hi. It's a good quesion.

There are two meanings.

 

1. It's only for C++ newcomers.

Sometimes they don't know the namespaces. So if I used a namespace, they can not access my classes.

2. What's the best (or better) naming rules.

Yeah. To use namespaces is good for sperating and organizing services and classes we know.

But mbed is full-opened and it has so many people, so If I added a namespace, then some people don't like that name maybe.

 

Anyway, Your suggestion is correct. :)

 

Regards

Shin.

11 Oct 2010

Hi Shin,

In fact, the mbed libraries are in a namespace called mbed. i.e. you can write:

DigitalOut x(LED1);
// or 
mbed::DigitalOut y(LED2);
However, mbed.h also includes the line:

using namespace mbed;
so you don't need to type it in front of everything (which would be tiresome), but still can use the namespace to distinguish them if you ever need to.

Hope that answers your question,

Simon

11 Oct 2010

Hi Simon-san

Oh. Thanks.

Regards

Shin. :)