script: Default script_verify_flags comparisons #34122

pull Brotcrunsher wants to merge 1 commits into bitcoin:master from Brotcrunsher:verify_flags_simplification changing 1 files +1 −7
  1. Brotcrunsher commented at 8:50 pm on December 19, 2025: contributor

    Replace the manual operator== and friend operator<=> in src/script/verify_flags.h with a defaulted member operator<=>.

    This reduces boilerplate while preserving the existing semantics (m_value comparison) and continues to provide ==, <, >, <=, and >= via the compiler-generated comparison operators.

    Note: This is a small refactor, but it removes duplicated comparison logic and reduces the chance of == and <=> diverging in future edits. If that’s not considered worthwhile, I can close/drop it.

  2. DrahtBot added the label Consensus on Dec 19, 2025
  3. DrahtBot commented at 8:50 pm on December 19, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34122.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK billymcbip

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  4. in src/script/verify_flags.h:49 in d33b770310
    51-    /** Compare two script_verify_flags. <, >, <=, and >= are auto-generated from this. */
    52-    friend constexpr std::strong_ordering operator<=>(const script_verify_flags& a, const script_verify_flags& b) noexcept
    53-    {
    54-        return a.m_value <=> b.m_value;
    55-    }
    56+    constexpr auto operator<=>(const script_verify_flags& other) const = default;
    


    billymcbip commented at 3:19 pm on December 27, 2025:

    Can you use std::strong_ordering instead of auto?

    I’m getting a Included header compare is not used directly lint warning for #include <compare> when using auto.


    Brotcrunsher commented at 8:30 pm on January 1, 2026:
    Done!
  5. script: Default script_verify_flags comparisons
    Replace the manual operator== and friend operator<=> in src/script/verify_flags.h
    with a defaulted member operator<=>.
    
    This reduces boilerplate while preserving the existing semantics (m_value
    comparison) and continues to provide ==, <, >, <=, and >= via the
    compiler-generated comparison operators.
    eaf2f07e42
  6. Brotcrunsher force-pushed on Jan 1, 2026
  7. billymcbip commented at 11:59 am on January 2, 2026: contributor
    tACK eaf2f07e42ac3574ea4b1b2fc9a5d11d3ab6ded2

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-07 03:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me