Things C++ 20 Deliberately Broke
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Mon Sep 26 22:30:45 UTC 2022
On Monday, 26 September 2022 at 22:15:49 UTC, Steven
Schveighoffer wrote:
> On 9/25/22 7:01 PM, Walter Bright wrote:
>> https://docs.google.com/presentation/d/1HwLNSyHxy203eptO9cbTmr7CH23sBGtTrfOmJf9n0ug/edit?usp=sharing&resourcekey=0-GH5F3wdP7D4dmxvLdBaMvw
>>
>>
>> https://news.ycombinator.com/item?id=32969957
>>
>
> From the document:
>
> > Math between disparate enums is deprecated
>
> Why? Why can't you add one enum to another when they are based
> on int, as long as it's typed as int?
>
> I'm honestly curious as to the problems this is solving.
Bugs. An enum is representant an enumeration or a set. You should
not mix those without a cast. C++ has the upgraded «enum class»
for this. You should usually use constexpr for constants.
More information about the Digitalmars-d
mailing list