Skip to content

Namespace for globals? #1468

Description

@johnomotani

Would it be a good idea to put the global variables defined in globals.hxx (mesh and dump) into a namespace like bout::globals?

I've come across bugs a few times caused by parts of the library using the global mesh when they should have been using a local one.

If we put using namespace bout::globals into physicsmodel.hxx then user code could use the global namespaces transparently and (once #1464 is merged) the using statement would not propagate into any library code except physicsmodel.hxx/cxx. This would help root out any remaining unintentional uses of the global variables in the library code, and places that we do want them (like default arguments) can use e.g. bout::globals::mesh to avoid any possibility of name conflicts.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalA code/feature outline proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions