This PR documents a recurring issue:
doc: Add switch on enum example to developer notes #17134
pull hebasto wants to merge 2 commits into bitcoin:master from hebasto:20191014-enum-doc changing 2 files +29 −1-
hebasto commented at 12:59 PM on October 14, 2019: member
-
util: Add AllowShortCaseLabelsOnASingleLine option 11e3d5eb1d
-
doc: Add switch on enum example c8961c7d9f
- fanquake added the label Docs on Oct 14, 2019
-
in doc/developer-notes.md:591 in c8961c7d9f
586 | + } // no default case, so the compiler can warn about missing cases 587 | + assert(false); 588 | +} 589 | +``` 590 | + 591 | +*Rationale*: The comment documents skipping `default:` label, and it complies with `clang-format` rules. The assertion prevents firing of `-Wreturn-type` warning on some compilers.
MarcoFalke commented at 1:09 PM on October 14, 2019:The warning is not wrong, though. While it is not undefined behavior to cast any
intto anenum classtype and pass it around (where it eventually will hit theassert), it seems the right thing to do for sanity.MarcoFalke commented at 1:09 PM on October 14, 2019: memberACK
promag commented at 2:24 PM on October 14, 2019: memberACK c8961c7d9fed07190628cf01f9dfad971a942b99, no excuse now, thanks!
laanwj commented at 2:26 PM on October 14, 2019: memberSeems like good advice to me. ACK c8961c7d9fed07190628cf01f9dfad971a942b99
practicalswift commented at 8:42 PM on October 14, 2019: contributorACK c8961c7d9fed07190628cf01f9dfad971a942b99
fanquake referenced this in commit dcc640811c on Oct 14, 2019fanquake merged this on Oct 14, 2019fanquake closed this on Oct 14, 2019hebasto deleted the branch on Oct 14, 2019fanquake referenced this in commit eb292af309 on Oct 15, 2019DrahtBot locked this on Feb 15, 2022
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-04-16 18:14 UTC
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-04-16 18:14 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me