[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Aw: Re: C++20 deprecation warning regarding enum arithmetic
- From: Mouse <mouse@...>
- Date: Wed, 22 Mar 2023 15:12:15 -0400 (EDT)
>> However, I would also argue that using enums as "just funny ints",
>> which semi-must be going on for adding enums from different
>> enumerations to make any semantic sense at all, is a Very Bad Idea,
>> even in C.
> I'm not a fan of #define constants at all, not even in C. When writing C, I $
Well, speaking purely personally, because it erases a useful conceptual
distinction - it conflates two conceptually distinct things (opaque
enumerated types and manifest constants). Adding enumeration constants
from two different enum types feels to me like a conceptual type
confusion on the order of adding an area to a temperature. (Indeed,
doing arithmetic on enum values at all feels to me like conceptual type
confusion of a different sort, imposing numeric values on conceptually
unordered set members.)
Of course, C doesn't have strict enumerated types and it doesn't have
manifest constants with non-preprocessor scoping. Those are among the
things I dislike about C.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B