News for hackers. Stuff that matters.
Re:Tell HN: C Experts Panel – Ask us anything about C by pantalaimon on Tuesday April 14, 2020 @09:39AM (#22865783)
Will C eventually get something like C++' constexpr?
Re:Tell HN: C Experts Panel – Ask us anything about C by AaronBallman on Tuesday April 14, 2020 @09:53AM (#22865946)
C has some basic support for constant expressions already, but there has not yet been a proposal to bring 'constexpr' over from C++. Personally, I would love this feature to be in C!
Re:Tell HN: C Experts Panel – Ask us anything about C by loeg on Tuesday April 14, 2020 @12:23PM (#22867860)
You and me both!
Re:Tell HN: C Experts Panel – Ask us anything about C by dktoao on Tuesday April 14, 2020 @10:48AM (#22866659)
This is really the only thing that I really want from C++. It would be amazing if this could make the cut for a future spec.

EDIT: I work on embedded systems, where C is king, and it seems like a spend an inordinate amount of time working with code generators that build simple tables. All of which could go away with this feature.

Re:Tell HN: C Experts Panel – Ask us anything about C by enhray on Tuesday April 14, 2020 @09:55PM (#22873664)
Why do you want it in C? What are your use cases?

I’ve always thought that idiomatic C for constexpr would be to write the code you want to be executed at compile-time in a separate file(s), build it, execute and then #include the result in your program before building the final executable, adding a build step but keeping overall complexity minimal.

This is different from C++ approach, where everything and the kitchen sink is added to the standard and then you have to issue errata for errata for the standard and hope that the compiler you have to use for your current platform is keeping up for the last changes.