Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
uecker
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
43 ms
·
931.
▲
by
uecker
1y ago
Good idea. This is very easy, here is a preview. https://godbolt.org/z/dME1MMr19
932.
▲
by
uecker
1y ago
What specific claim do you think is extraordinary: That embedded programmers still often use C, that compilation times for C++ are often very long, that the languages is less stable than C, or that code produced by C++ can be worse?
933.
▲
by
uecker
1y ago
GCC was written in C but changed to C++ later. A lot of the code still looks a lot like C. And as a contributor, I would much prefer it was purely C (and compilation times for GCC itself are a pain - although I think this is not because o
934.
▲
by
uecker
1y ago
I think Haskell is a cool language. It is still definitely very bad for what I use C for.
935.
▲
by
uecker
1y ago
I do not think it is obvious or trivial question. I think the problem is mostly that there is no money for enhancing the C ecosystem and educating people about possibilities. The cooperate money goes into random new things.
936.
▲
by
uecker
1y ago
I can agree with this. The difference is that C++ approach is to solve problems with features people need to understand while C solves problems by only providing basic building blocks and expects people to use them correctly. In both cases
937.
▲
by
uecker
1y ago
It is only undefined behavior if it is dereferenced, in which case the null sanitizer can be used to define it to trap, so safely terminate the program. But the example then also shows how you can make sure that this case is not even possib
938.
▲
by
uecker
1y ago
In the library I experiment with various things, and C23 and nested functions are not really required. And for running the code, it only relies on GNU statement expression. For bounds checking, you need need the sanitizers. Overall, it is
939.
▲
by
uecker
1y ago
You do not need constexpr, just remove the "volatile" which I put into my example only to prevent the optimizer from specializing it: https://godbolt.org/z/fs8q3sdxK But what matters is run-time behavior for
940.
▲
by
uecker
1y ago
Religion and the garbage code C++ compilers produces, incomprehensible error message, unstable tooling, and very long compilation times.
941.
▲
by
uecker
1y ago
I spent also countless amount of hours fixing template code, so no I do not let your anecdotes count. There is certainly a lot of problematic macro code in C, but I do not think it is worse than C++ templates, and one can also write robust
942.
▲
by
uecker
1y ago
There are many string libraries.
943.
▲
by
uecker
1y ago
I don't see how it safer. I think this is just a random claim C++ people like to make without any evidence. In terms of error message, the problem is that C++ often can not produce them because due to overloading it is entirely unclea
944.
▲
by
uecker
1y ago
Because the different languages suck much more.
945.
▲
by
uecker
1y ago
Sure.
946.
▲
by
uecker
1y ago
Whatever you do, please do not use a language that makes it difficult to provide security updates: https://www.debian.org/releases/trixie/release-notes/issues....
947.
▲
by
uecker
1y ago
The language is just fine. The real question is: Why do people not use a string library that abstracts this away safely?
948.
▲
by
uecker
1y ago
Yeah it a amazing a far C++ has come, soon it will be almost as good as C.
949.
▲
Generic Containers in C: Safe Division Using Maybe
(uecker.codeberg.page)
114 points
by
uecker
1y ago
|
61 comments
950.
▲
by
uecker
1y ago
I agree.
951.
▲
by
uecker
1y ago
I think it is relevant exactly because Rust exceptionalism is based on sloppy arguments that are fallacious because they narrow down topics and definitions in some invalid way, i.e. only considered memory safety while ignoring safety in gen
952.
▲
by
uecker
1y ago
Memory safety - as now being popularized by Rust in its current form - mostly corresponds to not having UB in C or C++. My point is that this not the only definition and not even the definition Rust started with. Memory leaks are often a p
953.
▲
by
uecker
1y ago
I do not find C code harder to understand than C++ - quite the opposite.
954.
▲
by
uecker
1y ago
Memory leaks are also a safety issue. Especially not running destructors can be a safety issue, but also a resource leak is at least a DoS. IIRC Rust also included not having memory leaks earlier in their definition of memory safety, but d
955.
▲
by
uecker
1y ago
You are already narrowing this down to only memory safety, which is part one of the Rust fallacies.
956.
▲
by
uecker
1y ago
And yet, in reality, Rust is also on the "if I am not sure I simply attest that it is fine" side on the fence.
957.
▲
by
uecker
1y ago
Note that only one or two lines of this file is needed here, the rest is for other experiments... And a user would simply use the "literal" macro. I also do not think the Zig version is really that much clearer or obvious. I wou
958.
▲
by
uecker
1y ago
It is great to see other languages getting the same compile-time meta programming features as C ;-) https://godbolt.org/z/P1r49nTWo
959.
▲
by
uecker
1y ago
It is not an attack if there is no privilege boundary in the first place. One could argue that should be, but then X's security would have also worked which is the point of the article. The problem was that Wayland propaganda pretended
960.
▲
by
uecker
1y ago
I hope so. WG14 seems to like it (but not everybody), but it is not existing practice. So it will mostly depend on me creating a prototype and doing a lot convincing.
More ›