25 karma · joined Nov 2, 2020 (6y ago) · 19 submissions
comment 2y ago · link · parent
Not C++ nor Rust?! What then, tia? C? Ada??
4.
Show HN: Generic dynamic array in almost 2k lines of C(github.com ↗)
1 points · by 6equj5 · 3y ago · discuss
comment 3y ago · link · parent
Explicitness: Consider the ambiguousness of `int foo_len` when you're swapping between meters and feet (but use `int` for both).
Ease maintenance: If you want to change the type you use to represent meters (say from `int` to `size_t`, since it might be wise to make it unsigned), compare going through the code and changing each meter-related instance of `int` vs. just changing the `meters_t` struct declaration.
More extensible: Compared to `typedef int meters_t`, using a struct is useful if you ever have to add to the struct. (Maybe a second numeric member representing the conversion to some other unit of length or something.)
For "meters", this doesn't really apply, but using a struct also prevents you from accidentally trying to do math with numeric types that you shouldn't do math with (like ID numbers or something): https://stackoverflow.com/a/18876104/9959012
Also, you probably shouldn't use `_t` at the end since that should be reserved by the C standard and by POSIX: https://stackoverflow.com/a/231807/9959012
comment 4y ago · link · parent
comment 4y ago · link · parent
The most amazing thing about it is how it manages to be so entertaining to read (the last thing I expected from a C++ textbook and a thing that made getting through it way easier)!
>I'm not sure if there's an even more recent edition that covers C++17 and C++20
Sadly, there is not. Scott for-the-most-part retired in 2015: https://scottmeyers.blogspot.com/2015/12/good-to-go.html
comment 4y ago · link · parent
comment 4y ago · link · parent
And that's still all we can say about at least one of them[0]. :)
0: https://en.wikipedia.org/wiki/Europa_(moon)#Habitability_pot...
comment 5y ago · link · parent
The big green guy is the new Logitech software suite that I need to use to set the sidetone on my new headset, which asks you at install time whether you want to enable telemetry yet doesn't actually let you proceed until "yes" is checked, and which is completely redundant to yet distinct from the old suite (which new versions of the same headset model don't work with) and works less well. The other aliens are update pop-ups.
comment 5y ago · link · parent
I often use it for timed tasks, and it's faster than reaching for my phone or even opening a browser tab (and, unlike a Google or DDG timer, it doesn't keep ringing until you re-raise the browser window, find the tab, and silence it, which always annoyed me). : p