←back to thread

The C23 edition of Modern C

(gustedt.wordpress.com)
515 points bwidlar | 2 comments | | HN request time: 0.428s | source
Show context
sylware ◴[] No.41857437[source]
I am worried where "official" C is going. Its syntax which is already too complex and already does too much, but that would require to "break" backward compatibility namely it would require "porting". But since it would be still "C" that amount of work should be close to "a bit" of "step by step" refactoring

For instance, only sized types:u8...s64, f32, f64... no implicit casts except for void* and literals, no integer promotion, no switch, no enum, only one loop keyword (loop{}!), no anonymous code block, and no toxic attribute like "packed structure" which makes us lose sight of data alignment... no _generic, typeof, restrict, syntax based tls, etc...

But we would need explicit atomics, explicit memory barriers, explicit unaligned memory access.

Instead of adding and complexifying C to make writing a naive compiler more and more complex, long and a mouse and cat catchup "to the standard" tedious task, what should be done is exactly the other way around.

In end, I don't trust C officials anymore, I tend to stick to C99, or even assembly (I am currently writing rv64 assembly I run an x86_64).

replies(1): >>41857827 #
1. eqvinox ◴[] No.41857827[source]
> I tend to stick to C99,

> […] But we would need explicit atomics, explicit memory barriers, […]

You should read a change summary before complaining about bits missing from C99 that have in fact been added to C11.

> […] no toxic attribute like "packed structure" which makes us lose sight of data alignment […]

And you should also familiarize yourself with what's in actual ISO C vs. compiler extensions before complaining about bits that are in fact compiler extensions.

replies(1): >>41858936 #
2. sylware ◴[] No.41858936[source]
I TEND to stick to C99 = usually C99 with very few bits of c11+ (usually the missing bits) and even some extensions (often related to ELF/object format). But I really try hard to minimize their usage.

The pb is in ISO c11+ we got some of the missing stuff for modern hardware architecture, but also tons of tantrums (_generic, typeof, restrict....)