Skip to content

Use do-while(0) to protect ADJUST_INDICES macro#121165

@picnixz

Description

@picnixz

Feature or enhancement

Proposal:

Use do-while(0) construction to protect the expansion of ADJUST_INDICES in:

  • #defineADJUST_INDICES(start, end, len) \
    if (end > len) \
    end = len; \
    else if (end < 0){\
    end += len; \
    if (end < 0) \
    end = 0; \
    } \
    if (start < 0){\
    start += len; \
    if (start < 0) \
    start = 0; \
    }
  • #defineADJUST_INDICES(start, end, len) \
    if (end > len) \
    end = len; \
    else if (end < 0){\
    end += len; \
    if (end < 0) \
    end = 0; \
    } \
    if (start < 0){\
    start += len; \
    if (start < 0) \
    start = 0; \
    }

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions