Skip to content

Refactor ConsoleArguments to use in-class initializers and remove redundant = operator (#962)#20248

Open
MichaelK05-dev wants to merge 1 commit into
microsoft:mainfrom
MichaelK05-dev:main
Open

Refactor ConsoleArguments to use in-class initializers and remove redundant = operator (#962)#20248
MichaelK05-dev wants to merge 1 commit into
microsoft:mainfrom
MichaelK05-dev:main

Conversation

@MichaelK05-dev
Copy link
Copy Markdown

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.

@MichaelK05-dev
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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

Successfully merging this pull request may close these issues.

1 participant