Refactor ConsoleArguments to use in-class initializers and remove redundant = operator (#962) by MichaelK05-dev · Pull Request #20248 · microsoft/terminal
Summary of the Pull Request
This PR refactors the ConsoleArguments class to use in-class member initializers for members with constant or default values, replacing equivalent entries in the constructor initializer list.
This change aligns the class with C++ Core Guidelines C.48 (“Prefer in-class initializers to member initializers in constructors for constant initializers”) while preserving existing behavior.
References and Relevant Issues
Detailed Description of the Pull Request / Additional comments
src/host/ConsoleArguments.hpp
- Added in-class default member initializers for members previously initialized with constant values.
Examples include:
_headless,
_width,
_height,
_forceV1,
_runAsComServer,
_forceNoHandoff - make operator= default
src/host/ConsoleArguments.cpp
- Removed redundant constructor member initializers corresponding to the in-class defaults.
- Members that depend on constructor parameters remain in the initializer list.
- Removed =operator as it is no longer needed since the default copy assignment operator performs the exact same now.
Validation Steps Performed
Manual Verification
- Performed strict code inspection to ensure a one-to-one correspondence between removed constructor initializers and added in-class initializers.