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

Clazy Warning Global Static #900

Open
jgehrig opened this issue Jul 27, 2021 · 1 comment
Open

Clazy Warning Global Static #900

jgehrig opened this issue Jul 27, 2021 · 1 comment

Comments

@jgehrig
Copy link
Collaborator

jgehrig commented Jul 27, 2021

TODO Tag in Code!

See app.cpp:
std::vector<MainWindow*> s_windows;

This code throws a Clazy warning because the CTOR is non-trivial.

Here is an alternative:

std::vector<MainWindow*>& GetWindowList() noexcept
{
  static `std::vector<MainWindow*> s_windows;`
  return s_windows;
}

// Replace all usage of "s_windows" with "GetWindowList()"

Open to other solutions too :)

@jgehrig
Copy link
Collaborator Author

jgehrig commented Jul 27, 2021

Optional:

Remove the other global statics. Global statics can cause all sorts of interesting issues...

Some people consider global statics a "code smell". If we can remove them easily, perhaps this is a good idea?

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

1 participant