Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
quelsolaar
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
6 ms
·
31.
▲
by
quelsolaar
2y ago
Alignment only matters when you use a pointer. This is a question of if technically non compatible signatures are UB by them selves. Unaligned access is UB for sure, but even if everything is perfectly aligned they may still be UB according
32.
▲
by
quelsolaar
2y ago
Lots of code has been broken because people have written UB code and then optimzers become smarter and vreak the code. This category of we call ”usless UB” are things that wont help optimizeayions, and all major compiler have to support bea
33.
▲
by
quelsolaar
2y ago
These things can be fixed and often are. Some one just needs to write a paper proposing a change. I might in fact do so on this issue. It should be resolvable.
34.
▲
by
quelsolaar
2y ago
This is one of the very rare cases in C where something is technically Undefined Behaviour, but in practice works and is recommended. The typedef struct trick, is very common idiom that creates _more_ safety, not less. All reasonable compil
35.
▲
by
quelsolaar
2y ago
Its not weak, its just not as crazy strong as people thought it was a few years back.
36.
▲
by
quelsolaar
2y ago
If you are buying hardware for billions of dollars, you can afford to spend a fair bit of engineering effort to make your code run on less expencive hardware.
37.
▲
by
quelsolaar
2y ago
My "one word broke C" article is wrong in all kinds of ways. I understand C way better than i used to. The things that need fixing in C are not UB, its very complex memory model stuff. I have no interest in changing any fundamenta
38.
▲
by
quelsolaar
2y ago
Id recomend watching this video on how UB works in C. https://www.youtube.com/watch?v=w3_e9vZj7D8 Compilers generaly do not abuse UB (outside of compiler bugs), its just that UB is a very missunderstood subject.
39.
▲
by
quelsolaar
2y ago
Im a member of the wg14 and the Undefined beahviour study group. We are producinga technical rapport about UB and one thing we specificly point out is that staticly known UB should be treated as an error, not as "this cant be called&qu
40.
▲
by
quelsolaar
2y ago
It would be super cool to see it generate the missing definitions and declarations to make it comparable in a regular C compiler. It would help a lot when reconstructing missing header files, and similar lost source data.
41.
▲
by
quelsolaar
3y ago
We used the same technique to port our C applications to Apple platforms, but to do so we wrote an automated tool that created a C wrapper for any cocoa API we need. It works on all current Apple platforms we have tried it on iOS,iPadOS, an
42.
▲
by
quelsolaar
3y ago
As the author notes, to know what C code does you need to run it. A good debgger is a C programmers best friend.
43.
▲
by
quelsolaar
3y ago
C suffers from a terrible case of survivor bias. C is so effective for writing all of the most critical software, that almost all software people trust is written in C. Therefore almost all critical vulnerabilities are found in C code.
44.
▲
by
quelsolaar
3y ago
Thw C standard has a list of all known UBs. We don't know if the list is complete, because the C standard makes anything not defined by omission UB, so its possible to discover new UB. The language is however pretty thoroughly explored
45.
▲
by
quelsolaar
3y ago
And C has a UB study group and we are working on a technical rapport that in great detail describes how UB works in C, and a comprehensive list of sample code for all known UB.
46.
▲
by
quelsolaar
3y ago
Provenance In C and Rust, essentially mean that each object, lives in its own memory space, and you cant travel between them. You cant use a pointer to one object, add an offset and get a valid pointer to another object. This is key to a lo
47.
▲
by
quelsolaar
3y ago
As someone who have implemented both EXR and PNG I can explain! Alpha can be used in multiple ways, most commonly as a blend: result = background * (1.0 - alpha) + forground * alpha; If the alpha and forground is stored in the same image, y
48.
▲
by
quelsolaar
3y ago
Yeah, its hard. But the original author complains about having to understand hard things, and then at the same time wonders why modern software sucks. You have your answer right there: If you don't understand a system you can utilize i
49.
▲
by
quelsolaar
3y ago
Yes, I used to work in the OpenGL architectural Review board. OpenGL, had fundamental limitations, that only a clean sheet design could overcome. Vulkan is in my opinion 90% the right design. The fact that Apple continues to be Apple is jus
50.
▲
by
quelsolaar
3y ago
What ever you think of Vulkan, it is NOT typical of modern software engineering. Its a massive outlier. It is very demanding of its users, it is very low level, it exposes the complexity of the hardware, it is large but not bloated, as it r
51.
▲
by
quelsolaar
3y ago
Im in the wg14 and this is not true. The later versions of the C standard are not dependable and diverges quite a bit from implementations. There are lots of things in the C standard text that you should not depend on. There are in fact ext
52.
▲
by
quelsolaar
3y ago
Im not recommending doing this, but you may want to allocate an address to use as a magic number. NULL is a magic number address that is guaranteed never to be a valid allocation. By allocating an address, you can creat your own magic numbe
53.
▲
by
quelsolaar
3y ago
Great post: Id be interested to see the difference between different C compilers, and to see what the difference is if the C code is compiled with a C++ compilers, if possible.
54.
▲
by
quelsolaar
3y ago
I am in the wg14. But you should not thank me for those features. I'm not very happy with C23. We are working on making UB more understood, and to try to eliminate some UB. To be clear: BSD was not breaking the standard, the standard d
55.
▲
by
quelsolaar
3y ago
Making realloc with a size 0 be undefined is a way of maintaining existing code, because it means that different implementations kan keep doing what they are doing. Some implementations free the pointer, some create a zero size allocation.
56.
▲
by
quelsolaar
3y ago
Yes, and much of what is in the later versions of the C standard haven't been adopted widely by C programmers.
57.
▲
by
quelsolaar
3y ago
You are right, but no language has tried to claim the space of giving the user more control, so C remains the lowest level language we have that is portable. I think there are lots of opportunities in this space, but i don't know of an
58.
▲
by
quelsolaar
3y ago
C gives you a level of control and responsibility not found in other languages. That's a choice, not something that is inherently worse. It may be worse for what you are doing. Most people don't value the level of control that C g
59.
▲
by
quelsolaar
3y ago
Let me _try_ to explain it. One reason is that non-atomic writes can be torn. So if you have a value like 0x00000000 and over write it with 0xFFFFFFFF, some hardware may do it as two separate writes. This means that another thread can read
60.
▲
by
quelsolaar
3y ago
I agree. The big problem here is that the meaning of a rare but valid peace of code has changed and almost no one knows about it. We don't break user space.
More ›