lawmurray
6
11
lawmurray

@programming.dev

Open source developer of Doxide for modern C++ documentation, and Birch for probabilistic programming.

lawmurray 11 points 3 years ago

I have Ubuntu 22.04 on a Dell XPS Plus 13 with OLED display. Looks great, battery life is good. Not sure how tuned the drivers are etc but definitely no need to avoid.

path: 0 588721, hotness: undefined, score: 11, children: 1
lawmurray 4 points 3 years ago

Welcome to C! Tiny suggestion to add to other comments: value is already Boolean, so there's no need to write if (value == 1), you can just write if (value). Similarly, following @chamaeleon@kbin.social's suggestion of using the ternary operator, you can write return value ? "Yes" : "No";.

path: 0 519584, hotness: undefined, score: 4, children: 0
lawmurray 3 points 3 years ago

Your get() function will always just return the value of the root node. I think you mean to have return get(value, ...) in each of its if statements.

path: 0 3382526, hotness: undefined, score: 3, children: 3
lawmurray 3 points 3 years ago

Nice. I'd not thought of that one.

path: 0 7084417 7087365, hotness: undefined, score: 3, children: 0
lawmurray 2 points 3 years ago

That's a fair criticism around relying on implicit type conversion mechanics, and part of the tradeoff to make. On the other hand, I imagine (and my imagination may be limited) that one downside of static_assert is to increase verbosity, something like:

auto r = f();
static_assert(std::is_same_v<decltype(r),MyReturnType>> || !is_expensive_conversion_v<MyReturnType>);
return r;
path: 0 5335339 5337974, hotness: undefined, score: 2, children: 3
lawmurray 2 points 3 years ago

Nice, good luck with it from here!

path: 0 3382526 3383771 3385036, hotness: undefined, score: 2, children: 1
lawmurray 2 points 3 years ago

For the array type it can be useful to allow implicit copy to different arithmetic types (design choice, I'm now back to explicit constructors to disallow this for what it's worth). If allowed though, I still wanted a compile time check like this to ensure that it wasn't happening by accident in particular circumstances.

path: 0 5335339 5337974 5731397 5757368 5757457, hotness: undefined, score: 2, children: 0
lawmurray 2 points 3 years ago

Yes, that's right, generic context, and you may be right on return value optimization. It was for implementing a collection of numerical functions that take array arguments, where the elements of those arrays could be of various arithmetic types, and the return type should be an array of a particular arithmetic type given promotion etc. The implementation was generic, and I was wanting to validate its correctness wrt return values having the correct arithmetic type without implicit copy.

path: 0 5335339 5337974 5731397 5757368, hotness: undefined, score: 2, children: 1
lawmurray 2 points 3 years ago

You might want to confirm that it is indeed zypper packages before you rearrange too much: Disk Usage Analysis on the desktop, or du -sch * on the console will get you some numbers by directory. It could also be cached packages, clean them up with zypper clean --all.

I'm not sure about specifying different destination directories with zypper, but you could try installing something like vscode from Flatpak rather than zypper, and specifying --user so it goes into your home directory (if that's a different partition).

I'd also look at your containers with podman and clean up any old ones, they can take up a lot of space.

path: 0 7394019, hotness: undefined, score: 2, children: 1
lawmurray 1 point 3 years ago

Yes, std::remove_cvref_t combines the other two, in fact I believe it does so precisely (see the "Possible Implementation" on cppreference.com). The "...with a little extra" that I mention for std::decay_t in the article is that it does the same as std::remove_cvref_t plus some standardization of array and function types to pointer types (again, see the "Possible implementation" of it on cppreference.com). For my purposes it doesn't really matter which to use, and I mostly prefer std::decay_t for its brevity.

path: 0 7918033 8083629, hotness: undefined, score: 1, children: 0
lawmurray 1 point 3 years ago

This would be better style in my opinion, but by way of correctness it seems the more fundamental issue is "return" missing in the if... else if... blocks.

path: 0 3382465 3382703, hotness: undefined, score: 1, children: 0

thanks for using Leebra!

go to feed...