Skip to content

Refactor: Use list initialization {} consistently instead of assignment operator = #102

Description

@coderabbitai

Description

This issue tracks a refactoring request to consistently use list initialization {} instead of the assignment operator = for variable declarations throughout the codebase to prevent narrowing conversions and improve consistency.

Background

List initialization (uniform initialization) introduced in C++11 provides several benefits:

  • Prevents narrowing conversions
  • More consistent syntax across different initialization contexts
  • Clearer intent in variable declarations

Current State

Currently, the codebase uses a mix of assignment operator = and list initialization {} for variable declarations.

Example of current code:

auto const timestamp = get_timestamp(log_event);

Should be refactored to:

auto const timestamp{get_timestamp(log_event)};

Scope

This refactoring should be applied consistently across all C++ files in the codebase where variable declarations currently use the assignment operator and can benefit from list initialization.

References

Requested by: @junhaoliao

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions