Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
listeria
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
14 ms
·
31.
▲
by
listeria
1y ago
In what ways is it unreliable? You're notified when a child is stopped, terminated, or continued, and you can make it so that you're only notified of termination using SA_NOCLDSTOP. How is `pidfd` better, why would you use it inst
32.
▲
by
listeria
1y ago
The technique described in the SO answer doesn't really apply here, since the write end of the pipe would be closed on exec in that case. Whereas in this case they're waiting for it to be closed after the child dies.
33.
▲
by
listeria
1y ago
This is the first I've heard of using an open pipe to poll for subprocess termination. Don't get me wrong, I don't hate it, but you could just as easily have a SIGCHLD handler write to your pipe (or do nothing, since poll(2
34.
▲
by
listeria
1y ago
have you heard of script/scriptreplay? script --log-timing file.tm --log-out script.out # do something in a terminal session ... scriptreplay --log-timing file.tm --log-out script.out # replay it, possibly pausing and increa
35.
▲
by
listeria
1y ago
In this case I would suggest using the high bits of the RNG output when generating a float, since some generators have better entropy around the high bits. So when you're generating floats with a 64-bit generator, instead of masking ou
36.
▲
by
listeria
1y ago
weirdly enough, the provided implementation of rand_float() actually generates numbers in the interval [0, 1). I haven't read the implementation of _generate_canonical_generic(), but the following special case in generate_canonical() a
37.
▲
by
listeria
1y ago
he's talking about how in C++ you write the modifier once, and all subsequent declarations have the same access specifier, i.e: class A { public: int a; float b; private: ... };
38.
▲
by
listeria
1y ago
I was actually thinking about something like this: "disclaimer: I'm the founder of Plandex: an open source AI coding agent" Note that I wouldn't personally add "open source", I don't think it adds to the d
39.
▲
by
listeria
1y ago
Shouldn't you have added a disclaimer, Mr. Founder of Plandex: an open source AI coding agent?
40.
▲
Show HN: A C++ Module Mapper
(codeberg.org)
3 points
by
listeria
1y ago
|
0 comments
41.
▲
by
listeria
1y ago
If the goal of testing on obscure compilers is to enhance such compilers then I'm all for it. But I don't see much value in having to dance around implementation details to support a compiler which isn't standards compliant.
42.
▲
by
listeria
1y ago
Apparently the static_assert trick doesn't work with GCC, it just compiles it with a warning if it's not a constant expression: warning: expression in static assertion is not an integer constant expression [-Wpedantic] Inst
43.
▲
by
listeria
2y ago
incidentally, the block allocator implementation fails to properly account for alignment requirements: since the underlying storage is std::array<char, ...>, it's alignment may be less that the required alignment of the requested
44.
▲
by
listeria
2y ago
You absolutely can do that in C++ with consteval + template, what's more, you don't even need consteval, constexpr will suffice: #include <cstdio> namespace detail { template<size_t N> struct Capitalize {
45.
▲
by
listeria
2y ago
I tried your example and got an error: error: type capture contains reference to comptime var I'm not sure how you were suppossed to use it but here's my attempt: fn capitalize(tag: []u8) []u8 { tag[0] &= 95;
46.
▲
by
listeria
2y ago
I'd normally agree with you, but in this case this function is meant to be used for vectorizable input so it doesn't really matter since it's using a random-access iterator, otherwise you should go with the usual std::count_i
47.
▲
by
listeria
2y ago
I also wrote a small tool to generate more templates, and it fits in a comment: usage: weeks YYYY-MM-DD YYYY-MM-DD weeks () { one_day=$((60 * 60 * 24)) unix_from=$(date +%s --date="$1") unix_to=$(date +%
48.
▲
by
listeria
2y ago
on the topic of alignment, the library (libpool) fails to align chunk_sz to allow storing a pointer when in the free_chunk list. This issue is sidestepped in TFA by using a union, which ensures appropiate alignment for all it's members
49.
▲
by
listeria
2y ago
package main import "fmt" func main() { fmt.Println("Hello world") }
50.
▲
by
listeria
2y ago
I see that you're using --print0 and -0 for your "git fza" alias, it might be useful to add -z to the git-ls-files invocation and --read0 to fzf.
51.
▲
by
listeria
2y ago
How is that a problem? infinities shouldn't be considered equal
52.
▲
by
listeria
2y ago
Consider dropping the specializations for the type traits, given that it's undefined behavior: https://en.cppreference.com/w/cpp/types/is_fundamental https://en.cppreference.com/w/cp
53.
▲
by
listeria
2y ago
Function overloading enables the building of powerful idioms like swap, operator== and this [1] proposal for composable hashing to name a few. And when combined with templates (and ADL to provide some encapsulation with namespaces) you can
54.
▲
by
listeria
2y ago
I don't know if std::condition_variable is async-signal safe, but an easy fix is to replace the sleeping with pause(2). There's also sigwait(3), which wouldn't need a signal handler.
55.
▲
by
listeria
2y ago
I thought I'd lose if the king was trapped—like some sort of stalemate—so I played through the game with that in mind. It might make for a fun variant. I should add I didn't expect to find the rules in the Post-mortem, so I gave u