Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
uecker
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
18 ms
·
361.
▲
by
uecker
6mo ago
I was not talking about curl, but the downstream products such as cars. And I am sure curl would appreciate support from car vendors, this was the point wasn't it?
362.
▲
by
uecker
6mo ago
As long as the memory-safe subset of Rust is used exclusively.
363.
▲
by
uecker
6mo ago
It talks about "installing software". You should definitely install updates from your Linux distribution and installing new packages from a curated repository is certainly not worse than having software already installed. Reducing
364.
▲
by
uecker
6mo ago
I am not talking about the open-source projects, but the downstream products such as cars that integrate curl.
365.
▲
by
uecker
6mo ago
The solution exists, and those are curated package repositories as we have in Linux distributions. In C I can simply install a -dev package and use some library which sees some quality control and security updates from the distribution. Th
366.
▲
by
uecker
6mo ago
The problem is that they get away too easily with bugs in their products they ship to customers. If this would come with some penalties, there would be some incentive to invest in security and this would probably often flow back to upstream
367.
▲
by
uecker
6mo ago
I was disagreeing with the statement that a "serious" language needs to have this hard-coded. think the C model where you can have the strictness if one wants to, but one can also opt-out is better.
368.
▲
by
uecker
6mo ago
It is wrong that signed types in C implement modular arithmetic. They have undefined behavior on overflow.
369.
▲
by
uecker
6mo ago
Any reasonably good C code I ever worked with aimed to be warning free. But yes, if you can also make it an error. The flexibility is important though.
370.
▲
by
uecker
6mo ago
You should know that the type is promoted to int first, which is also what makes your example work. This is what happens when you perform the computation using an non-promoting 8 bit unsigned type: https://godbolt.org/z/
371.
▲
by
uecker
6mo ago
This was not the original claim in the thread I responded to which as "even with a dynamically typed language, you can keep escaped strings as an Escaped class, with escape(str)->Escaped and dangerouslyAssumeEscaped(str)->Escaped
372.
▲
by
uecker
6mo ago
They described the use of abstract data types. One can certainly use those in most languages - for sure in C.
373.
▲
by
uecker
6mo ago
Singed integers in C do not implement modular arithmetic. You can trust me on this.
374.
▲
by
uecker
6mo ago
The point is that you can get the warnings without having to deal with a strict type system all the time.
375.
▲
by
uecker
6mo ago
That depends. But some sanitizer are cheap enough that you can usually always run them. Regarding infinite loops, C++ and C differ with C++ being more aggressive. But also compilers differ with clang being more aggressive. https:/
376.
▲
by
uecker
6mo ago
It was added, but immediately after the rest. I was just quickly refreshing my memory on what Rust was doing. I think it is a terrible design. If you want special function which protects you from errors in specific scenarios it is easy enou
377.
▲
by
uecker
6mo ago
I am not convinced. A byte is for low-level accessing of memory, you shouldn't really do any computation with it, except maybe low-level bit-fiddling or crypto, but then the non-wrapping non-negative inter is not correct either. Natura
378.
▲
by
uecker
6mo ago
What the parents describe can be done with almost any language.
379.
▲
by
uecker
6mo ago
Unsigned is certainly a misnomer for a wrapping type. That does not mean it is a type design mistake. And I agree that people should not use it much. But what I do not believe is that there is a real need for a non-wrapping non-negative int
380.
▲
by
uecker
6mo ago
You can have the trap during production, and then it is safer. If you need to catch the problem at run-time, there are checked integer options in C that you can use.
381.
▲
by
uecker
6mo ago
It is not even possible to do arithmetic on char in C.
382.
▲
by
uecker
6mo ago
For signed overflow we have sanitizers, and for conversions C compilers warnings in C. Bounds checking can also be done with sanitizers (but is a bit more tricky). So no, I do not think the undefined behavior is really a big problem. In fac
383.
▲
by
uecker
6mo ago
In C your compiler can help you with conversions and if not, please use a better one. In this regard, C is a very pragmatic language, and hence for actual work it is a more "serious" programming language than programming language
384.
▲
by
uecker
6mo ago
It is interesting that you find unsigned integers more intuitive. My experience (also with students, but also analysis of CVE give plenty of evidence) is that the opposite is true: signed integers in C are a model of integers which have a n
385.
▲
by
uecker
6mo ago
My copy of K&R already has unsigned modulo arithmetic: "unsigned numbers are always positive or zero, and obey the laws of arithmetic modulo 2n, where n is the number of bits in the type." So if it changed it was before that
386.
▲
by
uecker
6mo ago
Not sure what change in the C standard you mean. unsingned was always modulo. Otherwise, use -Wsign-conversion.
387.
▲
by
uecker
6mo ago
the reason is not that you want a negative index or size, but that you want the computation of the index to be correct, and you want to have obvious errors. Both turns out to be easier with signed types.
388.
▲
by
uecker
6mo ago
Having them available is not the issue, using them for sizes and indices is what causes a lot of tricky bugs.
389.
▲
by
uecker
6mo ago
Slightly tweaking might not always be sufficient. Reengineering my numerical code would certainly a bit of effort. But anyhow, I do not think C++ is better. Recently I removed one (!) file with templates (which someone else added) from one
390.
▲
by
uecker
6mo ago
In principle, the are supported already with gcc 12 or even earlier, but this is evolving. https://godbolt.org/z/88qv3jjTM I use c23 features but also vm-types for bounds checking which are older (i need the statement
More ›