Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ynik
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
13 ms
·
91.
▲
by
ynik
3y ago
IPv6 has the advantage that the ISP can give customers multiple prefixes at the same time, thus allowing rotation of the prefix without interrupting existing TCP connections. With IPv4, ISPs that want to rotate IP addresses have to forcibly
92.
▲
by
ynik
3y ago
Bubble sort is optimal for sorting data stored on tapes (no random access possible). If you have RAM, insertion sort is strictly superior (both simpler code + better performance).
93.
▲
by
ynik
3y ago
Because every Python object also contains a reference count (which needs to be modified whenever the object is passed around), a `const PyObject*` is effectively useless.
94.
▲
by
ynik
3y ago
These days, you're lucky if you get 5 years. Worst offender I have to deal with is "Jenkins LTS", which is supported for only 12 weeks.
95.
▲
by
ynik
3y ago
There's no way to make it work with the old ABI. Because sizeof(PyObject) is fixed in the old ABI, there's simply no way to attach additional information (e.g. the new cross-thread ref count) to every Python object. The Python ABI
96.
▲
by
ynik
3y ago
It's not a pointer. `std::optional<T>` is a class that directly contains a `T` (within a union) and happens to offer `operator*` and `operator->` providing an API similar to a smart pointer. This does not make it a pointer (th
97.
▲
by
ynik
3y ago
It's a fundamental design issue with Python package management that makes it impossible to pin the version of build-time dependencies. You can do everything seemingly right, with pip-tools creating lockfiles containing hashes of down
98.
▲
by
ynik
3y ago
It's not that hard to build a backtracking matching engine, at least if performance is not important. I did that in the past for the C# syntax tree used in a decompiler. Basically the syntax tree has a bunch of additional (non-syntax)
99.
▲
by
ynik
3y ago
`0.001` and `0.002` are essentially equally accurate as `1` and `2`. `1.001` and `1.002` are worse. In general, multiplicative scaling is useless with floating-point (*); but shifting the coordinate offset (additive, i.e. translation) can b
100.
▲
by
ynik
3y ago
gcc's c++20 support is still considered "experimental", which means libstdc++ does not guarantee ABI stability when using c++20. The JDK is compiled and distributed by various entities using various styles of linking. The lac
101.
▲
by
ynik
3y ago
In the compiler I'm working on, the only differences between selecting C11 and C17 modes are: * the value of __STDC_VERSION__ * DR423 ( https://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_423.h
102.
▲
by
ynik
3y ago
It may eventually have similar features with the same syntax; but the semantics will be slightly different (because the original Python semantics just aren't suitable for a compiled language). You won't be able to take existing Py
103.
▲
by
ynik
3y ago
Is zig's optimized float mode also extremely error-prone like gcc ffastmath? Reminder: With gcc/clang, -ffastmath makes it undefined behavior to run a calculation that results in an infinity or NaN. Due to the way UB works, the
104.
▲
by
ynik
3y ago
It's also not rare to find wrapper scripts that check "was there any output to stderr?", and if so, consider the program to have failed. Warnings are not errors, but also not output, so there isn't a good way to report t
105.
▲
by
ynik
3y ago
"Win32" refers to typical classic Windows applications (as opposed to the Win8+ "modern" kind), no matter whether they are 32-bit or 64-bit.
106.
▲
by
ynik
3y ago
But Rust has kind of a spec: https://doc.rust-lang.org/reference/ Sure, it's not as well-specified as C++; so one could say it's "not a real spec". But C++ also isn't perfect, there are plenty
107.
▲
by
ynik
3y ago
For compilers, arena allocation is king. IMHO: arenas > GC > RAII > malloc/free. With manual memory management (whether RAII or not), it's usually not difficult to add arenas into the mix. On the other hand, in GC languag
108.
▲
by
ynik
3y ago
"Standard C" is the C that was standardized. This is not what you get from your compiler by default! With gcc, you have to use `gcc -std=c99 -pedantic-errors`, otherwise it will accept programs which are invalid according to the s
109.
▲
by
ynik
3y ago
Lexers have a maximal-munch rule. Without a separate lexing stage, that's kinda hard to emulate within a parser (depends on the type of parser, I guess), as you'd end up with additional ambiguities.
110.
▲
by
ynik
3y ago
"Superset of Python with added features for systems-level code" sounds exactly like Cython. Strange that Cython isn't ever mentioned in any of the comparisons.
111.
▲
by
ynik
3y ago
The idea to let the compiler run the tests only works if you constexpr everything, which means putting all code in headers. This effectively means giving up on separate compilation. Worse, if you use some mixture (most code in headers but y
112.
▲
by
ynik
4y ago
To allow for chaining. Consider a statement like: a.f(foo(1)).g(foo(2)).arr[foo(3)].h(foo(4)); In C++14, the foo() calls happened in unspecified order. C++17 guarantees that "a(b)" and "a[b]" evaluate "a&qu
113.
▲
by
ynik
4y ago
That button was added to GitHub to protect against new bot accounts creating PRs against random projects, adding a CI step that runs a cryptominer. Now that the CI doesn't run automatically for new users without a button click, these a
114.
▲
by
ynik
4y ago
Note that while Windows small file IO is slow; it's extra-slow on C:. I have two partitions (C: and D:) on the same SSD, and creating a whole bunch of empty files (1.txt to 10000.txt) runs 2x faster on D: than it does on C:. I believe
115.
▲
by
ynik
4y ago
I think you misunderstood the article. That section is not talking about actual pointers. Filenames are like pointers, opening a file is like dereferencing the filename to get the actual file. Any other process could "free your point
116.
▲
by
ynik
4y ago
Important to note: this is dependent on the implementation-specific sizeof(int). So while on most architectures uint16_t is the unsigned type that cannot be safely multiplied; on others uint8_t or uint32_t might be unsafe to multiply. As a
117.
▲
by
ynik
4y ago
I think part of what makes programming languages hard to learn is that two authors rarely can agree on the same terminology. Reading a mixture of sources can lead to confusion about what's going on. This article explains the uniqueness
118.
▲
by
ynik
4y ago
Interesting, I wasn't aware of that one. I think `-D_GLIBCXX_ASSERTIONS` is more appropriate for catching this bug, but `-D_GLIBCXX_SANITIZE_VECTOR` seems useful for cases like this: https://gcc.godbolt.org/z/Ejrdo
119.
▲
by
ynik
4y ago
That's a special case due to an empty vector using nullptr, and thus causing language-level UB when doing pointer arithmetic with a nullptr. If you add an element to the vector and then remove it twice, asan will no longer find any pro
120.
▲
by
ynik
4y ago
pop_back() implementations have checks, but they're opt-in (and how to opt-in is specific to each implementation). This is just how C++ works: performance over safety, safety is semi-possible but requires a bunch of opt-ins. And the pa
More ›