Skip to content

"using namespace" is inside of mbed.h #7248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Alex-EEE opened this issue Jun 18, 2018 · 2 comments
Closed

"using namespace" is inside of mbed.h #7248

Alex-EEE opened this issue Jun 18, 2018 · 2 comments

Comments

@Alex-EEE
Copy link
Contributor

Description

mbed.h has "using namespace std" and "using namespace mbed" . Just spent a bunch of time debugging something b/c I had no idea my namespace had gotten clobbered. Putting using declarations in a header file is forbidden in almost every text written about C++ style:
https://stackoverflow.com/questions/5849457/using-namespace-in-c-headers

This is especially bad considering that you need to include "mbed.h" almost everywhere

You guys should refactor this out.

Or a simpler way out would be to deprecate "mbed.h", and make a "new_mbed.h" that has all the #includes, and mbed.h could look like this, for backwards compatibility:

#include "new_mbed.h"
using namespace mbed;
using namespace std;

[ ] Question
[ X ] Enhancement
[ ] Bug

@ciarmcom
Copy link
Member

ARM Internal Ref: MBOTRIAGE-774

@0xc0170
Copy link
Contributor

0xc0170 commented Jun 19, 2018

Hi @Alex-EEE , thanks for the report.

This is a duplicate #5679 where you can find more information. Add your feedback there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants