Hi,
Is this really so bad?

float a = 0;
float b = 0;
float c = 0;
float d = 0;
float a1 = 0.1f;
float b1 = 0.1f;
float c1 = 0.1f;
float d1 = 0.1f;

Jeremy


On Sun, Jun 8, 2025 at 3:08 PM Smith, Jim via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
Hi All,

I suggest the following:

float{} a, b, c, d;  // Initializes all variables to zero
float{0.1f} a1, b1, c1, d1;  // Initializes all variables to 0.1

Rationale:

    - Conciseness: This approach reduces redundancy, making the code more compact and readable by eliminating the need to repeat initialization values for each variable.

    - Consistency: When initializing multiple variables with the same value, it streamlines the process, avoiding repetitive declarations.

    - Clarity of Intent: The use of {} makes it immediately clear that each variable is being initialized to a specific value, without the clutter of individual assignments.

    - Cleaner Declarations: Especially in cases with many variables, this approach allows for a cleaner, more organized declaration without compromising on clarity.


Best regards,
James S.

--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals