Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, because C is, by virtue of its history and central role in the development of all mainstream operating systems, the lowest common denominator.

Also, if I remember correctly, the first Rust and Go compilers were written in C.





Yes! It's easy to see why we got here, but that doesn't mean it's the optimal outcome!

Rust used OCaml, and Go only used C, because it was partially created by the C authors, and they repurposed the Plan 9 C compiler for Go.

Usually it helps to know why some decision was taken, it isn't always because of the technology alone.


OCaml was used for rust.

> Yes, because C is, by virtue of its history

Sure history is great and all, but in C it's hard to say reliably define this int is 64-bit wide, because of the wobbly type system. Plus, the whole historical baggage of not having 128-bit wide ints. Or sane strings (not null terminated).


> in C it's hard to say reliably define this int is 64-bit wide

That isn't really a problem any more (since c99). You can define it as uint64_t.

But we have a ton of existing APIs that are defined using the wobbly types, so we're kind of stuck with it. And even new APIs use the wobbly types because the author didn't use that for whatever reason.

But that is far from the only issue.

128 bit ints is definitely a problem though, you don't even get agreement between different compilers on the same os on the same hardware.


> 128 bit ints is definitely a problem though, you don't even get agreement between different compilers on the same os on the same hardware.

you technically have _BitInt(128) in C23, but I'm not sure that would even generate what you expect it to.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: