Hacker News·4 min read·hard

Your C is not standard C

D
dverlaeckt80
✦AI Summary

The author argues that the C programming language standard has diverged significantly from how compilers like GCC and Clang actually implement it. The piece highlights specific technical incompatibilities regarding keywords and floating-point arithmetic.

Why it matters

Understanding the gap between language standards and compiler implementation is critical for systems programmers and software reliability.

✦Dive DeeperCreate a free account to unlock

The committee has created an unreal language that no one can or will actually use.

this is an incomplete list of some incompatibilities between c as it's written in the standard and c as it exists in the real world for people who use gcc/clang + glibc/musl.

by default, gcc and clang recognize the asm keyword as an extension. this is not strictly conformant, because in standard c, asm is a valid non-reserved identifier. so code which conforms to the standard may not compile with gcc/clang with their default settings.

and like, whatever, that's fine, that's why -std exists, but 1. it's notable that compilers aren't conformant by default , and 2. why doesn't the standard just make asm a reserved word? c++ does that; i'm not sure why c doesn't.

the standard specifies the FLT_ROUNDS macro in float.h as follows:

Continue reading on Headlinne

Create a free account to read the full article.

Read full article →
technology
✦

Get smarter about the news

Sign up free for a feed built around what you actually care about, Dive Deeper research on any story, and the full text of every article.

Create free account

Already have an account? Sign in