r/cpp • • Feb 26 '20

We need epochs (Rant)

I have spent 1 hour copy pasting the most stupid and repetitive code ever in order to enable the comparison operator== to several structs that are trivially comparable. When I search for why the compiler isn't able to generate this for me, when is clearly able to generate the assignment operator, I found out some C compatibilities shenanigans. We need some way to release us from that, we are in 2020 for Ilúvatar sake.

Edit: There are some closeted virtue signaling gatekeepers in this sub. Thanks for taking so seriously a rant ... I guess.

0 Upvotes

28 comments sorted by

View all comments

30

u/Voltra_Neo Feb 26 '20

operator<=> = default

  • C++20

-6

u/[deleted] Feb 26 '20

I'm luckily if I'm able to develop using 17. And not the ugly mess of C89, C++03 legacy code base that are reused until the earth stops spinning.

20

u/SeanMiddleditch Feb 26 '20

How would epochs help if you can't use a new standard that supports them?

-4

u/[deleted] Feb 26 '20

I never suggest that that will help me today, but the sooner we could have a new standard totally independent from C, but without losing the capacity of interacting with C code. The sooner we will be able to use it. Let say that when a new standard comes out most of us can use it in production like in 3 or 4 years best case scenario. The sooner a thing comes out the sooner the clock can start clicking.

3

u/moreVCAs Feb 26 '20

C89 is really hard. I had to work with a wonky proprietary cross compiler a few years ago that only supported a subset of C89. Truly a miserable experience.

2

u/[deleted] Feb 26 '20

An even some times you can use C99 but someone somewhere in the company will pull a "coding best practices standard" from his ass, with things like "you can't use the ternary operator" without any rationale. Even MISRA and AUTOSAR allows the ternary operator.