←back to thread

The C23 edition of Modern C

(gustedt.wordpress.com)
397 points bwidlar | 3 comments | | HN request time: 0s | source
Show context
ralphc ◴[] No.41851601[source]
How does "Modern" C compare safety-wise to Rust or Zig?
replies(4): >>41852048 #>>41852113 #>>41852498 #>>41856856 #
WalterBright ◴[] No.41852113[source]
Modern C still promptly decays an array to a pointer, so no array bounds checking is possible.

D does not decay arrays, so D has array bounds checking.

Note that array overflow bugs are consistently the #1 problem with shipped C code, by a wide margin.

replies(1): >>41852316 #
layer8 ◴[] No.41852316[source]
> no array bounds checking is possible.

This isn’t strictly true, a C implementation is allowed to associate memory-range (or more generally, pointer provenance) metadata with a pointer.

The DeathStation 9000 features a conforming C implementation which is known to catch all array bounds violations. ;)

replies(4): >>41852348 #>>41852932 #>>41854734 #>>41855111 #
TZubiri ◴[] No.41852932[source]
"The DeathStation 9000"

The what now?

replies(2): >>41853018 #>>41853918 #
layer8 ◴[] No.41853018{3}[source]
Google it.
replies(1): >>41854150 #
1. TZubiri ◴[] No.41854150{4}[source]
Yeah, why have any type of human interaction in a forum when you can just refer your fellow brethren to the automaton.
replies(1): >>41854271 #
2. layer8 ◴[] No.41854271[source]
I’m saying this because any explanation I could offer would provide less insight than the Google results.
replies(1): >>41854957 #
3. TZubiri ◴[] No.41854957[source]
Less insight, perhaps, but of higher quality, which is subjective.

I personally find that googling stuff provides not much connection to the subject of study, very impersonal and try to avoid it.

For example I did google the concept, and found this https://github.com/cousteaulecommandant/ds9k.

Which is not trivial to parse, bing posited the answer as authoritative, and if you look at the code it is really nothing, it seems to be a folklore concept, and as such, it is much more aptly transmitted by speaking to a human and getting a live version than by googling an authoratitative static answer.