Skip to content

P3776 Another motivating example for trailing commas #75

@fdwr

Description

@fdwr

Another motivating example we've encountered multiple times in our codebase that's not listed in P3776R1 section 3 is when you later need to add a parameter to an existing function call, but to avoid client breakage, you do so conditionally via the preprocessor and build flags:

    inline Expression Resample(
        Expression input,
        TensorDimensions outputSizes,
        DML_INTERPOLATION_MODE mode,
        DML_AXIS_DIRECTION roundingDirection,
        Span<const float> scales,
        Span<const float> inputPixelOffsets,
        Span<const float> outputPixelOffsets   // <--- want comma here 😀
#if DML_TARGET_VERSION >= 0x6400
        , bool antialiased   // <--- must hackily move it here 🫤
#endif
        )
    {

Because trailing commas are currently prohibited though, you need the ugly hack of moving the last comma in front of the last parameter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-workSome work is required

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions