Page MenuHomePhabricator

Merge #10742: scripted-diff: Use scoped enumerations (C++11, "enum class")
AbandonedPublic

Authored by jasonbcox on Mar 18 2019, 18:08.

Details

Reviewers
deadalnix
Fabien
Group Reviewers
Restricted Project
Summary

1f45e21 scripted-diff: Convert 11 enums into scoped enums (C++11) (practicalswift)

Pull request description:

Rationale (from Bjarne Stroustrup's ["C++11 FAQ"](http://www.stroustrup.com/C++11FAQ.html#enum)):

>
> The enum classes ("new enums", "strong enums") address three problems with traditional C++ enumerations:
>
> * conventional enums implicitly convert to int, causing errors when someone does not want an enumeration to act as an integer.
> * conventional enums export their enumerators to the surrounding scope, causing name clashes.
> * the underlying type of an enum cannot be specified, causing confusion, compatibility problems, and makes forward declaration impossible.
>
> The new enums are "enum class" because they combine aspects of traditional enumerations (names values) with aspects of classes (scoped members and absence of conversions).

Tree-SHA512: 9656e1cf4c3cabd4378c7a38d0c2eaf79e4a54d204a3c5762330840e55ee7e141e188a3efb2b4daf0ef3110bbaff80d8b9253abf2a9b015cdc4d60b49ac2b914

Backport of Core PR 10742
https://github.com/bitcoin/bitcoin/pull/10742/files
Completes T549

Test Plan

ninja check
test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Branch
pr10742
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5233
Build 8529: Bitcoin ABC Buildbot (legacy)
Build 8528: arc lint + arc unit

Event Timeline

Fabien requested changes to this revision.Mar 19 2019, 16:53
Fabien added inline comments.
src/script/interpreter.h
30

This should not be necessary

src/test/data/tx_invalid.json
261

I think you may better refactor/remove the comment to not use the enum (eventually in another diff) rather than adding an unused enum for this.

src/test/versionbits_tests.cpp
117
This revision now requires changes to proceed.Mar 19 2019, 16:53

Fabien has also requested that I break this diff up by enum. I will do that, as this diff is rather long.

src/script/interpreter.h
30

Will remove.

src/test/data/tx_invalid.json
261

Agreed.

src/test/versionbits_tests.cpp
117

BIP9 was removed, so I don't think that commit adds any value.