Skip to content

Modernize macros to use do { } while (0) instead of { }Β #3830

@terrelln

Description

@terrelln

Our macros don't currently use the safer do { } while (0) construction because our Visual Studios CI used to error on this construction. It complained about constant false branches. Our new Visual Studios CI doesn't error on do { } while (0).

terrelln#4

This is standards compliant behavior, and newer Visual Studios doesn't warn on it, so IMO we should switch to this construction.

Based on this discussion this bug was fixed in VS2015. So the tradeoff is that we will get warnings/errors with Visual Studios older than 2015.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions