←back to thread

The C23 edition of Modern C

(gustedt.wordpress.com)
515 points bwidlar | 1 comments | | HN request time: 0.239s | source
Show context
israrkhan ◴[] No.41855279[source]
Most important aspect of C is its portability. From small microcontrollers to almost any computing platform. I doubt that any new version of C will see that much adoption.

If I want to live on cutting edge I would rather use C++2x or Rust rather than C.

Am I missing something? What benefit this supposedly modern C offers?

replies(7): >>41855343 #>>41855410 #>>41855595 #>>41855880 #>>41856401 #>>41858691 #>>41860058 #
flohofwoe ◴[] No.41856401[source]
One advantage of writing C code is that you don't have annoying discussions about what idiomatic code is supposed to look like, and what language subset is the right one ;)

For the cutting edge I would recommend Zig btw, much less language complexity than both modern C++ and Rust.

One good but less visible side effect of C23 is that it harmonizes more syntax with C++ (like ... = {} vs {0}) which makes it a bit less annoying for us C library maintainers to support the people how want to compile their C code with a C++ compiler.

replies(2): >>41856506 #>>41858603 #
Arch-TK ◴[] No.41858603[source]
> C library maintainers to support the people how want to compile their C code with a C++ compiler.

Just tell them to go away.

Trying to write the subset of C and C++ is a fool's errand.

replies(1): >>41860015 #
jstarks ◴[] No.41860015[source]
No inline functions in library headers, then.
replies(1): >>41860766 #
1. flohofwoe ◴[] No.41860766[source]
Inline is mostly pointless in C anyway though.

But it might be a minor problem for STB-style header libraries.

It's not uncommon for C++ projects to include the implementation of an STB-style header into a C++ source file instead of 'isolating' them in a C source file. That's about the only reason why I still support the common C/C++ subset in my C libraries.