Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
uecker
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
33 ms
·
961.
▲
by
uecker
1y ago
Indeed https://github.com/Aishou/wayland-keylogger
962.
▲
by
uecker
1y ago
There official platform ABIs. There are not called C ABIs though.
963.
▲
by
uecker
1y ago
Things like this resulting in differnt alignment between Clang and GCC on x86_64 for _Atomic struct { char a[3]; }; See: https://godbolt.org/z/v5hsjhzj9 The problem is that in C++ these atomics are library types, but
964.
▲
by
uecker
1y ago
Not sure what you mean by "Not sure why people put up with it". Glibc is licensed under LGPL, so you can distribute it proprietary software even with static linking under some conditions. And there also other alternatives.
965.
▲
by
uecker
1y ago
Sorry, this is nonsense. Binaries link just fine on Linux. If you use a compiler flag that changes the ABI, then you are on your own, of course, but the GCC docu makes it very clear which specific flags those are. There is some corner case
966.
▲
by
uecker
1y ago
I was asking the question why one would ever want it.
967.
▲
by
uecker
1y ago
When I implemented this, I did some minimal benchmarking. Realloc was easily fast enough to cover all my use cases. I am not Facebook who need to optimize the single last byte of their string type. For the fast case, there is the alternati
968.
▲
by
uecker
1y ago
This is an old tradition in ISO C. unsigned actually means modulo and const actually means immutable.
969.
▲
by
uecker
1y ago
Sure, but _Record would add even more complexity. The tag rules I had changed in C23 were a step to remove complexity, so a step towards cleaning it up. I wasn't able to fix the untagged case, because WG14 had concerns, but I think t
970.
▲
by
uecker
1y ago
I am not terribly excited about this proposal. It is overly complex.
971.
▲
by
uecker
1y ago
I assume you do not want to elaborate why you think it is a "bad fit". IMHO it is perfect.
972.
▲
by
uecker
1y ago
The first stack / heap collisions were not using VLA but fixed size arrays on the stack. Nowadays compilers do stack probing, which solves this problem also for VLAs. Yes, you get a segfault for stack overflow, but this has not much
973.
▲
by
uecker
1y ago
You can also put them safely on the stack. The VLA is discussion is just irrational.
974.
▲
by
uecker
1y ago
What isn't clear to me why one would ever want monomorphization in the first place.
975.
▲
by
uecker
1y ago
Why would you think this? My implementation is type and bounds safe and nice to use.
976.
▲
by
uecker
1y ago
It would be interesting to understand better where language feature are actually needed or helpful, and where the code should be organized differently. I also observe that often cure if worse than the disease. Many example I see where peop
977.
▲
by
uecker
1y ago
It may be debatable, but I would say C++'s template syntax is not nicer. I do not think working with void pointers is annoying, but I also prefer the container_of approach. The ## certainly has the limitation that you need to name thi
978.
▲
by
uecker
1y ago
There are less annoying ways to implement this in C. There are at least two different common approaches which avoid having macro code for the generic functions: The first is to put this into an include file #define type_argument int
979.
▲
by
uecker
1y ago
Exactly! Why would I want to add my own memory management logic on top of the memory management logic that already exist. One valid reason might be that I can't rely on realloc not be poor, but then I would rather use my own special a
980.
▲
by
uecker
1y ago
Yes! I try do this here (this code is not tested and may not be up-to-date): https://github.com/uecker/noplate/blob/main/src/vec.h#L30 The issue with the boundary is what I meant with hysteresis in
981.
▲
by
uecker
1y ago
Why not C? Its only real issue is that people will constantly tell you how bad it is and how their language of choice is so much better. But if you look at how things work out in practice, you can usually do things very nicely in C.
982.
▲
by
uecker
1y ago
Except that I find C++ far from being perfect. In fact, I switched from C++ to C (a while ago) to avoid its issues and I am being much happier I also find my vec(int) much nicer. In fact, we are at the moment ripping out some template cod
983.
▲
by
uecker
1y ago
I don't struggle, I switch from C++ to C and find this much nicer.
984.
▲
by
uecker
1y ago
If I have some time, I will do some benchmarking. In all my current code where I tried it makes no noticeable difference, and I am not a fan of premature optimization. But then, I could always switch to the alternative API.
985.
▲
by
uecker
1y ago
"arbitrary concrete behavior" means that at this point anything can happen on the real machine. This implies that everything before this point has to behave according to the specification. "is impossible" is stronger, a
986.
▲
by
uecker
1y ago
It could. I like things being spelled out explicitly. Otherwise I would probably not use C.
987.
▲
by
uecker
1y ago
If all you do is call abort anyway, you do not need an interface that makes you test for errors.
988.
▲
by
uecker
1y ago
No, I claim that the performance of realloc is good enough for most use cases because it also does not move the memory in case there is already enough space left. I then mention that for other use cases, you can maintain a capacity field o
989.
▲
by
uecker
1y ago
And you could easily add a version with a custom allocator if you need it.
990.
▲
by
uecker
1y ago
Why? I do not find the ergonomics bad. It is also not clear how you get tap completion with code generation. But you could also get tab completion here, somebody just has to add this to the tab completion logic.
More ›