2,488 karma · joined Apr 14, 2020 (6y ago) · 2,122 submissions
comment 16h ago · link · parent
Also to be fair, it has to be said that officially blessed safe Rust code is not really what is competing with C.
comment 1d ago · link · parent
The committee wanted to have TS 6010 which would clarify that this work, but at the request of compiler vendors it is not (yet) part of the IS. But the reasons are unrelated to pointer round trips.
comment 1d ago · link · parent
Sometimes I am wondering whether I should continue to develop my own compiler with an eye towards correctness, but I do not have enough time at the moment. And fixing bugs in GCC seems more useful.
comment 1d ago · link · parent
- It does not run code behind my back when I access a field.
- I see when a pointer is used, so the syntactic distinction between -> and . is important.
Being able to change this without changing these little things is far less important to me than being able to understand important properties of the code just by looking at it.
comment 1d ago · link · parent
Those types can be written in a way that C's type system checks type safety, and my example was of this kind. No "pinky promises" necessary. In fact, these types are very similar to templates in C++. I would even agree that there are bad, but just in the same way templates in C++ are also bad.
And finally: you can also write a sort that inlines its comparator in C as well.
comment 1d ago · link · parent
Here is an example for a generic vector type: https://godbolt.org/z/7MdGqcdbq
Your mistake is believing that you need native syntax for such feature to be possible. But this is not true.
comment 2d ago · link · parent
Update: In fact, you can also build quite reliable abstractions around incomplete structure types. Those abstractions are better than what C++ adds, where the abstractions in the header are all very fragile.
comment 4d ago · link · parent
Not that are wraparound CVEs in Rust as well, so there is no perfect solution even outside of C.
comment 4d ago · link · parent
comment 4d ago · link · parent
If you want a safe interface that does not require passing random sizes around in extra arguments, this can also be done in C.