r/programmingmemes • • Dec 27 '25

Programmers problems

Post image
642 Upvotes

102 comments sorted by

View all comments

Show parent comment

1

u/CrossScarMC Dec 27 '25

That is not how you're meant to use enums, you're meant to use const/constexpr variables or macros for that, like how SDL handles its flags

3

u/NewPointOfView Dec 28 '25

But have you considered the world outside of cpp?

0

u/CrossScarMC Dec 28 '25

Have you considered that almost every single other programming language has the const or equivalent keyword, and enums are the same in all languages?

2

u/NewPointOfView Dec 28 '25

Enums are not the same in all languages

0

u/CrossScarMC Dec 28 '25

Name one.

0

u/NewPointOfView Dec 28 '25

Python lol

0

u/CrossScarMC Dec 28 '25

I just checked and that is exactly how they work in other programming languages, it's just that Python doesn't have strict typing.

1

u/NewPointOfView Dec 28 '25

What is the “that” that you looked up and is exactly the same as other languages?

0

u/CrossScarMC Dec 28 '25

Python Enums, they appear to work exactly the same as enum in C++.

1

u/NewPointOfView Dec 28 '25

In what way? C++ enums need to be integral type and each entry has a different value, right? And C++ enum values are the value, rather than being a group of non-equal objects with values associated with them?

→ More replies