Skip to content

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

Closed

Description

@picnixz

Feature or enhancement

Proposal:

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

  • #define ADJUST_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; \
    }
  • #define ADJUST_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

Activity

  1. added a commit that references this issue on Jul 2, 2024
  2. added a commit that references this issue on Jul 3, 2024
  3. added a commit that references this issue on Jul 11, 2024
  4. added a commit that references this issue on Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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