-
Notifications
You must be signed in to change notification settings - Fork 11
Refactor: Use list initialization {} consistently instead of assignment operator = #102
Copy link
Copy link
Open
Description
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
- Original discussion: feat: Add support for parsing UTC offset in seconds per log event and returning it in decode results (resolves #79). #99 (comment)
- Related PR: feat: Add support for parsing UTC offset in seconds per log event and returning it in decode results (resolves #79). #99
Requested by: @junhaoliao
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels