Better HN
topnewbestaskshowjobs
Log inSign up

GrumpySloth

4,901 karma · joined Sep 13, 2020 (6y ago) · 1,641 submissions

Submissions

comment 2y ago · link · parent

If you call mmap/VirtualAlloc/open/fopen in your constructor and later it throws, you will have a resource leak, because the destructor won’t clean it up.

comment 2y ago · link · parent

If you call mmap/VirtualAlloc/open/fopen in your constructor and later it throws, you will have a resource leak, because the destructor won’t clean it up.

comment 2y ago · link · parent

C++ and Java, which have many implementations, also have proprietary distributions, see Apple’s fork of Clang, Microsoft’s MSVC, Azul VM, Jamaica VM, ...

And some of them are pretty nice. Life is good.

comment 2y ago · link · parent

Maintaining state invariants is trivial without exceptions thrown from constructors. Just make constructors private and write a public static factory method. Allowing exceptions in constructors on the other hand creates the problem of: what should the destructor of an only partially constructed object do? It’s just unnecessary.

comment 2y ago · link · parent

Depends on the number of people in the photo. And on whether you can identify the face of the person in the photo. E.g. recently when many people used facemasks that made a lot of photos of them legal to publish. And if there is a crowd of people, e.g. 10 people, then you can publish even with the faces visible.

comment 2y ago · link · parent

Measurements suggest that binary search is at least competitive with linear search and is often the winner, so it’s a reasonable default[1].

But naive binary search can also be improved upon by dividing the searched space into 3 subranges instead of 2[2].

[1]: <https://www.pvk.ca/Blog/2012/07/03/binary-search-star-elimin...>

[2]: <https://www.pvk.ca/Blog/2012/07/30/binary-search-is-a-pathol...>

comment 2y ago · link · parent

Action which I find much more useful than Back is Up. I’m always annoyed when someone hands me their Android to do something and I need to go through 10 screens hitting Back instead of Up. I almost never want Back. I want Up. This is also reflected in my use of Finder on Mac e.g. where I often hit Cmd+Up, but never Cmd+Left.

comment 2y ago · link · parent

> We can already do that at leisure, but most would not care to go a whole day (let alone every day) trudging around by necessity.

We can do that at best 2/7 days a week. In reality, modern life forces us to dedicate even less time to that.

I've done that many times. The feeling at the end of the day is always unlike any other. Wouldn't swap those experiences for anything else.

> You seem to be framing the search for food as a low-stakes endeavor.

Have you ever picked mushrooms? Do you know how little time it takes to get enough mushrooms for weeks to come? And then how much meat there is in a deer?

I agree that the risk of being murdered is higher. Although I think you overestimate the frequency of encounters. There weren't a lot of people back then on Earth. I also don't think this decreases happiness all that much. The slow senseless willowing away in an office everyday seems like a much less happy existence, even if it's a longer one.

comment 2y ago · link · parent

Yes?

Spend a day endlessly walking (roaming), searching in the forest for berries, mushrooms etc., doing hand-to-hand combat, hunting...

Spend a day in front of a computer.

Which one do you think will end in a feeling of happiness?

comment 2y ago · link · parent

A similar warning could be enabled in GCC using the flag -Wsign-compare.

comment 2y ago · link · parent

In this case more important than any runtime overflow/underflow checks is the fact that the compiler will check that comparison operands are of the same type instead of inserting an implicit cast. Instead the programmer is forced to insert an explicit conversion like .try_into().unwrap(), which clearly suggests the possibility of an error. And if the error isn't handled, it will panic.

https://play.rust-lang.org/?version=stable&mode=debug&editio...

comment 2y ago · link · parent

Which is why the Rust compiler itself uses a non-cryptographic hash, which takes just 3 x86 instructions and can work on 8 bytes at a time: <https://github.com/rust-lang/rustc-hash/blob/master/src/lib....>

comment 2y ago · link · parent

Given that shutter sounds are produced, I'd guess the shutter is opened[1]:

> During this time, shutter sounds will be produced.

[1]: <https://helpguide.sony.net/ilc/2010/v1/en/contents/TP0003229...>

comment 2y ago · link · parent

Most do. Some, like Nikon Z8 and Z9, don't.

comment 2y ago · link · parent

You’re right. I misremembered. The term is “shutter life”. Same result though.

comment 2y ago · link · parent

Does it affect RAW photos or only JPEGs?

comment 2y ago · link · parent

Every photo taken shortens the life of a sensor.

comment 2y ago · link · parent

Same. And same selection of OS-es. :)

comment 2y ago · link · parent

You’ve just compared a densely populated city with a sparsely populated state that’s several times the size of the country the aforementioned city is located in. And then started talking about highways.

comment 2y ago · link · parent

You need better friends. ;)

comment 2y ago · link · parent

In my opinion, the best way to interact with ETW is through DTrace. Microsoft’s GUIs like WPA-Xperf are so buggy and unreliable that using them feels utterly futile. DTrace on Windows on the other hand is very usable.

comment 2y ago · link · parent

No. I mean getting drenched, when forecast predicted no rain. 1mm isn’t really noticeable by humans.

comment 2y ago · link · parent

Absolutely. 15 years ago I could reasonably trust forecasts regarding whether it’s going to rain in a given location 2 days in advance. Today I can’t trust forecasts about whether it’s raining currently.

comment 2y ago · link · parent

> disabling the writing of 'last accessed' timestamps

atime is the most useless filesystem feature I’ve heard of. But on most Unix-like systems it’s enabled by default and the main thing it does is turn reads into writes, degrading performance. All the while ctime isn’t a standard Unix filesystem feature. And ctime to me always seemed infinitely more useful (and cheaper!) than atime.

</rant>

comment 2y ago · link · parent

> To be fair, if something is on Mac, it is usually on Linux.

That's true only for CLI apps. My most frequently used GUI apps on Mac:

- MailMate

- Affinity Photo

- ACDSee Photo Studio

- NetNewsWire

- ApolloOne

- Textual

- Transmit

- iA Writer

None of them are available on Linux. Most of them are Mac-only (i.e. no Windows version either).

comment 2y ago · link · parent

Another instance of pedestrian congestion that’s really jarring to me are serial pedestrian crossings on roads with opposing traffic lanes separated by pavement, often on intersections. It may look like this: <https://maps.app.goo.gl/ErBFC2oXV21oQ9U7A>. For some reason, the traffic lights are programmed in such a way that most of the time you need to be almost running (I’d say something like 8-10 km/h) to ever have a chance of crossing both crossings in one go, even when you start walking at the beginning of the green light. Instead you’re almost always (the durations change throughout the day) guaranteed to stop before the second light and have fun breathing in the fumes from a high-traffic road. I can’t think of it as anything but hostile to pedestrians.

comment 3y ago · link · parent

It was Go. Rust has many converts from C++. But from scripting languages too. It’s a pretty heterogenous programmer-base.
1
567
55