HNHacker News
TopNewBestAskShowJobs

planede

2,063 karma · joined April 21, 2022

submissionscomments
planede··on You've just inherited a legacy C++ codebase, now what?
You mean the guys the company laid off last week?
planede··on You've just inherited a legacy C++ codebase, now what?
I assume it's clangd? It can be used from vim, vscode, ... etc as well and get a uniform IDE diagnostic experience across text editors.
planede··on You've just inherited a legacy C++ codebase, now what?
IMO there is absolutely no reason to enable warnings in CI without -Werror. Nobody reads the logs of a successful build.

If some warnings are flaky then disable them specifically. In my experience most warnings in -Wall are OK and you can suppress the rare false positives in code. Don't suppress without a comment.

edit:

Having said that there are entirely valid reasons to not have -Werror outside of CI. It should be absolutely disabled by default if you distribute source.

planede··on C++20 Idioms for Parameter Packs
Context. I assume you mean something like `void foo(size_t ...Idxs)`, which indeed doesn't work. It can't work, as nothing indicates that this would be a template, and it should be at least templated on the size of the pack.

<size_t ...Idxs> works because it introduces a pack that is a template parameter, so it naturally gets templated on the size of the pack (as well as on the values).

I guess an other historical issue for the grammar is that without the parameter name, `void foo(size_t ...)` is already valid grammar, and is equivalent to `void foo(size_t, ...)`, a C-style variadic.

planede··on C++20 Idioms for Parameter Packs
You don't need recursion, but you do need a template, AFAIK.

https://godbolt.org/z/o53o53W5r

planede··on C++20 Idioms for Parameter Packs
cppinsights.io shows expanded function templates as explicit specializations. It's built on LLVM, but I don't think that this tool is upstreamed.

https://cppinsights.io/lnk?code=dm9pZCBmb28oYXV0bykge30KCnZv...

planede··on On the impossibility of composing finalizers and FFI
In C++ that would be an "aliasing shared_ptr", for a reference counting example of the same idea.
planede··on Intel Processor Instability Causing Oodle Decompression Failures
I agree. However voltage is relevant for insulation, which also affects how heat can dissipate for the wire, and might also be relevant for a failing wire, when higher and higher voltage can build up at the point of failure (not sure if it's a common engineering consideration outside of fuses, which are designed to fail).
planede··on I turned my ThinkPad into a programmable USB device
Or just netcat. Throw in tar if you copy a directory.
planede··on Things unexpectedly named after people (2020)
Funnily enough I know this desert by its translated name to Hungarian as "Német csokoládé torta".
planede··on LED Matrix Earrings
As for multi-color individual green and blue leds could be just mixed in.

Do blue leds consume significantly more power too for the same brightness, or only their voltage is higher?

planede··on Floats Are Weird
The math hinges on that there is the same error for exp(x) at both places. So as long as exp(x) is deterministic then this should be alright.
planede··on The existence of a new kind of magnet has been confirmed
Paramagnetism/diamagnetism doesn't apply to "magnets", which I assume you use to refer to materials that have external magnetic field without applying external excitation.
planede··on Induced demand is not a useful concept
Roads can be efficient, as buses exist. Cars are not.
planede··on VR porn a no go for Apple Vision Pro users as capability blocked by Apple
Do they actively block porn, or the browser just doesn't support rendering VR content yet?
planede··on I accidentally Blender VSE
About transparency and blending: Please use premultiplied alpha for the arithmetic (and a linear colorspace, but hopefully that already happens).
planede··on Figure out who's leaving the company: dump, diff, repeat
Ouch. My takeaway is that I should probably delete my slack account before leaving the company.
planede··on When "letting it crash" is not enough
I saw a tech demo somewhere that showcased that Qt applications on wayland could be checkpointed and restored with CRIU.
planede··on Should error messages apologize? (2013)
The only GCC error that apologizes (that I know of):

https://godbolt.org/z/GMxz5c339

"sorry, unimplemented". It really felt out-of-place when I first encountered it, but I think it messages intent a bit more than a simple "unimplemented" error message. It at least suggests that this is a shortcoming of the current implementation, so it might get implemented in a later version.

Having said that clang also doesn't implement this, and the error message doesn't apologize: "error: cannot compile this lambda conversion to variadic function yet"

planede··on Two's complement integers with only sign bit set should be a trap representation
A trap representation is not a NaN-like sentinel value. The post also didn't discuss the updated semantics of integer operations, but I assume it just simply shrinks the range of representable values by removing -2^(N-1), and operations with a resulting value that lie outside are still undefined.

Having a NaN-like sentinel with is another option, with overflowing integer operations defaulting to that value instead, but that's not what is proposed here.

The post does mention optional<int>, which could have the NaN-like sentinel (empty optional) by reusing the bit-pattern of the trap representation of the underlying int.

planede··on Two's complement integers with only sign bit set should be a trap representation
> Personally, my preferred behavior would be to have a compiler flag that could be used to enable a trap if unsigned arithmetic resulted in wrap-around, as in the above case when the vector is of length zero.

That probably has the potential of having too many false positives. It's also very non-confroming, so I see why compiler vendors would be reluctant to add such a flag.

planede··on Two's complement integers with only sign bit set should be a trap representation
-ftrapv is an implementation-provided flag that defines the behavior of some operations that are otherwise not defined by the language standard. The implementation could define the behavior (under the same or different flags) to this newly introduced trap representation as well (no need to actually trap).

Having said that this should be a new type, adding more UB to existing types is a bad idea.

planede··on Neovide – A simple, no-nonsense, cross-platform GUI for Neovim
Some keywords are `mousemoveevent' and '<MouseMove>'. Then you can hook up anything into a mousemove event, including activating an LSP hover window. I like to activate hover info by keyboard, so I never looked into this.
planede··on Neovide – A simple, no-nonsense, cross-platform GUI for Neovim
You can have hover support even in a terminal nvim instance, so maybe that's just not a distinguishing feature.
planede··on Testing how hard it is to cheat with ChatGPT in interviews
> "Type the question into ChatGPT and do what it says" is not the "how" that companies are looking for.

They are probably not looking for that, because LLMs perform poorly with some kind of problems, and you don't want people who rely on them heavily.

This gives you a plan for designing the interview questions.

planede··on Testing how hard it is to cheat with ChatGPT in interviews
No, I don't think that's reasonable. Any outside resource ranges from pen and paper, a basic calculator to all the books you have, the Internet, ChatGPT and the help of other people.

I would say that the only thing that should be assumed implicitly is that it's forbidden to use the help of other people. Anything else should be explicitly laid out.

Having said that if some rule is not clear or evident then the interviewee should ask. And they should never be dishonest.

planede··on A confusing probability question: Red and green balls in an urn
> However the fact that our first n=1 sample happened to be red (and not something else) gives a small (and varying) amount of confidence towards red-heavier mixes rather than the red-scarce ones.

I wouldn't characterize this as a small amount of confidence, as conditional distribution of the mix-rate after the first sample drastically differs from the prior.

Originally each mix-rate has 1/101 probablity. After the sample having a mix with n reds in it has the probablity 2n/(100101).

planede··on The Apparent Simplicity of RGB Rendering
I think translucency is mostly whacky because it's typically represented by a single alpha channel, and a tint is represented by a color added on top. Which is not how most transparent materials look like.

I think we could do better, even in RGB by treating translucency as a 3x3 matrix instead of a single alpha scalar. Per-channel transparency could be represented by a diagonal matrix, but there is no reason that the current RGB basis would be adequate for representing transparent materials, hence the generalization to a 3x3 matrix.

Then a tint wouldn't need to be defined additively, a green tinted glass could simply not let most of red and blue through.

planede··on Apple Vision Pro review: magic, until it's not
They possibly had to include training data tagged with "inactive" though, including that.
planede··on On the Costs of Syscalls (2021)
That doesn't mean that code pages couldn't be shared. The data that differs per process is a single number in this case.

Having said that I agree that it's probably not worth it to put getpid() into vDSO.

← PreviousPage 5 of 24Next →