Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ynik
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
31.
▲
by
ynik
2y ago
But if you're on 64-bit; you can just create the threads with a huge stack size limit (e.g. 1GB) and let the OS handle automatically growing the actual stack size. No need to reinvent the wheel. Stack size is the one area where Windows
32.
▲
by
ynik
2y ago
That's no longer true: https://www.intel.com/content/www/us/en/developer/articles/t... x86 hardware does not guarantee anything unless you enable "Data Operand Independent Timing Mode
33.
▲
by
ynik
2y ago
But does `printf();` return to the caller unconditionally? This is far from obvious -- especially once SIGPIPE comes into play, it's quite possible that printf will terminate the program and prevent the undefined behavior from occurrin
34.
▲
by
ynik
2y ago
But a function blocking indefinitely while repeatedly writing to a volatile variable is well-defined. So the compiler cannot remove a function call followed by UB unless it knows that the function won't do that. In theory, the compiler
35.
▲
by
ynik
2y ago
That's not true. If you do `5 / argc`, that's only undefined behavior if your program is called without any arguments; if there are arguments then the behavior is well defined. Instead, the presence of UB in the execution pat
36.
▲
by
ynik
2y ago
It causes a panic if the write to stdout fails (e.g. if it's a pipe and the other side was closed, or if stdout is redirected to a file and the disk is full). The rust compiler requires handling this potential error in some way, or you
37.
▲
by
ynik
2y ago
Yep. Timezone definitions already change regularly due to governments messing around with time; so software is already set up to handle this case. Though I wonder what happens with the international dateline -- would it shift around the wor
38.
▲
by
ynik
2y ago
I thinks that's far from the only problem. To me the most obvious problem is that we use right-to-left numbers (think about the order you're writing digits when doing long addition) in a left-to-right language. Without a special n
39.
▲
by
ynik
2y ago
> If anything is trying to route to only 4 octlets, routers add a 1. in front of it. Bam, legacy solved. Only for unidirectional UDP. How do you think the other side would be able to respond if it's unaware of the 5th octlet? Basica
40.
▲
by
ynik
2y ago
You are mistaken there. An array `int arr[10][20][30];` is a single contiguous (stack) allocation. I recommend you read up on what pointer decay actually does; it's more complicated than replacing all arrays with pointers! In particula
41.
▲
by
ynik
2y ago
I find it's best to treat this as a case of "cross-compilation to old glibc version". That is, you don't want to just link against an old glibc version, you want a full cross-compilation toolchain where the compiler does
42.
▲
by
ynik
2y ago
It's expected that a warmer year would be warmer at the majority of points in time. Variance should normally result in there being both warmer and colder points. To be warmer at every point in time, the year needs to be significantly w
43.
▲
by
ynik
2y ago
Caution! If you compare across languages like that, not all virtual calls are implemented equally. A C++ virtual call is just a load from a fixed offset in the vtbl followed by an indirect call. This is fairly cheap, on modern CPUs pretty m
44.
▲
by
ynik
3y ago
Your software will still "lose" cents if you use integers, for operations such as dividing a bill (e.g. divide by 3), or applying 3% APR in monthly increments. The goal is not to avoid rounding errors (which would be quite difficu
45.
▲
by
ynik
3y ago
This particular approach of hooking would be much harder; but a malicious xz has other options as well. It's already in the code path used by dpkg when unpacking packages for security updates, so it could just modify the sshd binary, o
46.
▲
by
ynik
3y ago
But don't forget that xz is also used as part of dpkg for unpacking packages. The whole purpose of dpkg is to update critical system packages. Any SELinux policy that protects from a backdoored dpkg/xz installing a rootkit during
47.
▲
by
ynik
3y ago
But there's also the not-so-common (yet still somewhat frequent) case where the inputs are highly different. Myers diff alone would take quadratic time, which in practice is often unacceptable. Real-world implementations often have a l
48.
▲
by
ynik
3y ago
multiprocessing only works fine when you're working on problems that don't require 10+ GB of memory per process . Once you have significant memory usage, you really need to find a way to share that memory across multiple CPU core
49.
▲
by
ynik
3y ago
It's about letting the TCP implementations on the end-points know early that the capacity of the link has been reached; so that they adjust their bandwidth usage before a long queue (which would cause latency) accumulates on the router
50.
▲
by
ynik
3y ago
Belt balancing is necessary when unloading trains, as otherwise uneven consumption can lead to some chests/wagons running out of resources but the train doesn't leave because other wagons are still full. For mining outputs, it can
51.
▲
by
ynik
3y ago
The problem is that uninitialized memory really is subtle. After initializing all members of a struct, the padding bytes of that struct are still uninitialized. Yet, it is valid to memcpy the whole struct somewhere else; even with a hand-
52.
▲
by
ynik
3y ago
The buffer bloat issue happens due to bad queue management on the router immediately preceding the bottleneck link. Whether the queue management happens in "hardware" or "software" depends on the router (but I suspect it
53.
▲
by
ynik
3y ago
Theoretically possible? Yes: https://chown.me/blog/getting-my-own-asn A good idea? No. IP addresses are used for routing. Every provider-independent block of addresses needs its own entry in the global routing tables,
54.
▲
by
ynik
3y ago
Missing from your timeline: 2006-05-01 NIST SP 800-57 Part 1 Rev. 1 is published, which recommends to stop using 1024-bit DSA by 2010. 2010 passes, but OpenSSH never added support for DSA with keylengths larger than 1024-bit. 201
55.
▲
by
ynik
3y ago
The problem is that: * CPython is slow, making extension modules written in C(++) very attractive * The CPython extension API exposes many implementation details * Making use of those implementation details helps those extension modules
56.
▲
by
ynik
3y ago
& vs && doesn't feel like a problem to me. & vs == is the real problem: `(val & MASK) == CONSTANT` needs parentheses due to this mistake. `a & (b == c)` essentially almost never makes sense (== gives you a boole
57.
▲
by
ynik
3y ago
Unfortunately even though this was called out as a mistake in 1982, much more modern languages (e.g. C#) are still copying it. As painful as breaking changes might be, they beat the alternative of dealing with a bad design indefinitely. At
58.
▲
by
ynik
3y ago
That only works if the system is accessing mostly anonymous pages. If the load on the system is accessing plenty of mmapped code/data pages, it can still trash those even if swap is disabled. I've still seen systems hanging for 10
59.
▲
by
ynik
3y ago
Non-type template parameters (NTTP) were already in the original standard, they've existed since C++ had templates. Being able to use "auto" for the type of the NTTP was new in C++17; and using class types like std::array for
60.
▲
by
ynik
3y ago
Even assembly doesn't work anymore, as CPU manufacturers no longer guarantee constant-time execution unless the software opts-in to constant-time mode: https://lore.kernel.org/lkml/YwgCrqutxmX0W72r@gmail.com/
More ›