Hacker News

Favorites Setup
Comment by _ph_ | original | C for Rust programmers
[−]_ph_ · 2026-10-11 Sun 10:01 UTC · link
Which, to be provocative, begs the question: why isn't this tooling part of the compiler, that is, why aren't the diagnostics always produced by default, or even considered errors?
[−]daymanstep · 2026-10-11 Sun 10:17 UTC · link
Changing defaults has a tendency to break people's workflows e.g. for scripts that expect a fixed format output.
[−]_ph_ · 2026-10-11 Sun 10:28 UTC · link
Sure, but looking at C's age, the language was changed significantly over time. With one of those changes, certain things could have been considered compile errors, not optional tooling.

Or if you turn your argument around: if people depend on workflows and automation (I do of course too), then this is a good reason to standardize the diagnostics and errors of the checking tools to the point where the workflows and automation can depend on them. Otherwise they will remain tools which are completely optional to run, or even worse, are not part of your normal work flow.

[−]uecker · 2026-10-11 Sun 10:54 UTC · link
Why "could have"? Compilers have a lot more warnings than the used to, and also defaults got more strict.
[−]pjmlp · 2026-10-11 Sun 11:41 UTC · link
ISO languages don't define tooling, so the only way would be to introduce new semantics.

However, like in any ISO languages, that only happens if enough people vote for it, and someone is willing to submit a paper in first place.

[−]pjmlp · 2026-10-11 Sun 10:26 UTC · link
Because of developer culture mostly.

In some circles having the compiler dictate the way, and only true way, is seen as straightjacket programming.

[−]uecker · 2026-10-11 Sun 11:24 UTC · link
The most push back we get against making the language or compiler stricter is not for this reason though, it is mostly that the maintenance burden for existing code is considered to high.

But this illustrates how absurd the discussion is nowadays. Incrementally making things stricter and fixing warnings along the way is one of the most cost efficient way to improve quality and safety. Rewriting the software one of the most expensive. So if the former is rejected because the burden is too high, then obviously the overall aim to make things safer can not be too important and the push for rewrites must partially be motivated by other interests.

[−]pjmlp · 2026-10-11 Sun 11:39 UTC · link
I saw this talk yesterday,

"The Power of Ten: Rules for Safety Critical Coding by Gerard Holzmann"

https://youtu.be/GRJtYwneG2Q?is=M0z7hnpQ78C8fLLP

At a moment he mentions a trick he played on JPL folks, his static analysis tool, instead of showing all the issues found, would only display the top 10, without telling them there were actually more than 10.

So they felt motivated to fix them, it were only 10 after all.

Naturally eventually they became aware of the trick.

[−]Someone · 2026-10-11 Sun 10:52 UTC · link
One reason is that there is no such thing as the compiler. C ‘always’ had many different implementations.

Requiring all of them to adopt common linting rules at the same time is infeasible.

Also, it’s not true that linting rules never become part of the compiler. For example, the original lint (https://wolfram.schneider.org/bsd/7thEdManVol2/lint/lint.pdf) states

“The type-checking rules also require that, in structure references, the left operand of the -> be a pointer to structure”

and mentions warnings on such statements as

  int i 1;
  i =- 1;
Modern C compilers also warn way more often about unreachable code, pointer incompatibilities, etc. than those from the 1970s