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

[C++] Fix "reorder" warnings (make constructor initializers match member order) #139

Open
JoeStrout opened this issue Feb 25, 2024 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@JoeStrout
Copy link
Owner

If you compile the MiniScript source code using a compiler that supports the "reorder" warning (-Wreorder), such as gcc/g++, then this warning crops up in quite a few places. For example:

MiniScript/MiniscriptInterpreter.h:155:25: warning: 'MiniScript::Interpreter::parser' will be initialized after [-Wreorder]
  155 |                 Parser *parser;
      |                         ^~~~~~
MiniScript/MiniscriptInterpreter.h:45:26: warning:   'MiniScript::Machine* MiniScript::Interpreter::vm' [-Wreorder]
   45 |                 Machine *vm;
      |                          ^~
MiniScript/MiniscriptInterpreter.cpp:15:9: warning:   when initialized here [-Wreorder]
   15 |         Interpreter::Interpreter() : standardOutput(nullptr), errorOutput(nullptr), implicitOutput(nullptr),
      |         ^~~~~~~~~~~

I don't think there's anywhere that this really matters, but in order to compile cleanly, it'd be a good idea to make these orders match (reasons why are explained at [https://stackoverflow.com/questions/1828037]).

So, get yourself set up with such an environment, and fix all the "reorder" warnings by either changing the order of declarations in the header to match the constructor, or changing the order of initializers in the constructor to match the declarations.

@JoeStrout JoeStrout added help wanted Extra attention is needed good first issue Good for newcomers labels Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant