Skip to content
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

Move classes to namespace #218

Closed
PeterJohnson opened this issue Sep 5, 2016 · 0 comments · Fixed by #311
Closed

Move classes to namespace #218

PeterJohnson opened this issue Sep 5, 2016 · 0 comments · Fixed by #311
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Milestone

Comments

@PeterJohnson
Copy link
Member

Currently all WPILib classes are in the global namespace. This is not good practice for a number of reasons (WPILib additions can conflict with existing user code, makes it easier to violate the one definition rule and end up with undefined behavior). All classes should instead be in a namespace (wpi and frc are reasonable options). A backwards compatibility shim can be provided (turned on by default) with something like the following in the headers and/or adding it to the Eclipse template:

#ifndef NAMESPACED_WPILIB
using namespace frc;
#endif
@PeterJohnson PeterJohnson added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Sep 5, 2016
@PeterJohnson PeterJohnson added this to the 2018 milestone Sep 5, 2016
PeterJohnson added a commit to PeterJohnson/allwpilib that referenced this issue Nov 1, 2016
Base.h provides a backwards compatibility shim (enabled unless
NAMESPACED_WPILIB is defined) that does a "using namespace frc".
However, as some header files do not include Base.h, this may
be a breaking change in some corner cases (with an easy fix).

Fixes wpilibsuite#218.
PeterJohnson added a commit to PeterJohnson/allwpilib that referenced this issue Nov 2, 2016
Base.h provides a backwards compatibility shim (enabled unless
NAMESPACED_WPILIB is defined) that does a "using namespace frc".
However, as some header files do not include Base.h, this may
be a breaking change in some corner cases (with an easy fix).

Fixes wpilibsuite#218.
PeterJohnson added a commit that referenced this issue Nov 2, 2016
Base.h provides a backwards compatibility shim (enabled unless
NAMESPACED_WPILIB is defined) that does a "using namespace frc".
However, as some header files do not include Base.h, this may
be a breaking change in some corner cases (with an easy fix).

Fixes #218.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature Brand new functionality, features, pages, workflows, endpoints, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant