Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
mort96
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
34 ms
·
721.
▲
by
mort96
8mo ago
I imagine these Mac Minis aren't logged in to an Apple ID. Unlike Microsoft, Apple doesn't force you to connect your hardware to their cloud.
722.
▲
by
mort96
8mo ago
C in C++ is a pretty terrible experience. The differences your asterisk alludes to are actually quite significant in practice: C++ doesn't let you implicitly cast from void* to other pointer types. This breaks the way you typically hea
723.
▲
by
mort96
8mo ago
Free works with NULL, but not all cleanup functions do. Instead of deciding whether to defer before or after the null check on a case-by-case basis based on whether the cleanup function handles NULL gracefully, I would just always do the de
724.
▲
by
mort96
8mo ago
And the consequence is that, at least in C++, we don't see the benefit you describe of "objects can never be in an uninitialized or partially-initialized state". Anyway, I think this could be fixed, if we wanted to. C just
725.
▲
by
mort96
8mo ago
I don't typically do that. In 99.999% of cases, 'defer free(something)' was done because it's the correct thing to do at every exit point, so I don't need to think about it at the end of the block.
726.
▲
by
mort96
8mo ago
This sounds like a nice theoretical benefit to a theoretical RAII system (or even a practical benefit to RAII in Rust), but in C++, I encounter no end of bugs related to uninitialized or partially initialized objects. All primitive types ha
727.
▲
by
mort96
8mo ago
No it wouldn't. 'err' is declared and initialized at the start of the function. Even if it wasn't initialized at the start, it would've been initialized by some earlier fallible function call which is also written a
728.
▲
by
mort96
8mo ago
The forward goto cleanup pattern is not something "wrong" that was done to "avoid typing". Goto cleanup is the only reasonable way I know to semi-reliably clean up resources in C, and is widely used among most of the lar
729.
▲
by
mort96
9mo ago
I know. Or in some cases, you can put the loop body in a dedicated function. There are workarounds. It's just bad that the wrong way a) is the most obvious way, and b) is silently wrong in such a way that it appears to work during te
730.
▲
by
mort96
9mo ago
Is that true though? Using defer, the code would be: if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0) return err; return err; This has the exact same bug: the function exits with a successful re
731.
▲
by
mort96
9mo ago
I hate that you can't call defer in a loop. I hate even more that you can call defer in a loop, and it will appear to work, as long as the loop has relatively few iterations, and is just silently massively wasteful.
732.
▲
by
mort96
9mo ago
People often say that "RAII" is kind of a misnomer; the real power of RAII is deterministic destruction. And I agree with this sentiment; resource acquisition is the boring part of RAII, deterministic destruction is where the util
733.
▲
by
mort96
9mo ago
If I'm gonna write RAII wrappers around every tiny little thing that I happen to need to call once... I might as well just use Rust and make the wrappers do FFI. If I'm constructing a particular C object once in my entire code bas
734.
▲
by
mort96
9mo ago
C++ implementations of defer are either really ugly thanks to using lambdas and explicitly named variables which only exist to have scoped object, or they depend on macros which need to have either a long manually namespaced name or you ris
735.
▲
by
mort96
9mo ago
Why is this a relevant comment? We're talking about C, not C++. If you wanted to suggest using an alternative language, you're probably better off recommending Zig: defer takes 0 lines to implement there, and it's closer to C
736.
▲
by
mort96
9mo ago
Defer is a very simple feature where all code is still clearly visible and nothing is called behind your back. I write a lot of C++, and it's a vastly more complex language than "C with defer". Defer is so natural to C that a
737.
▲
by
mort96
9mo ago
I love RAII. C++ and Rust are my favourite languages for a lot of things thanks to RAII. RAII is not the right solution for C. I wouldn't want C to grow constructors and destructors. So far, C only runs the code you ask it to; turning
738.
▲
by
mort96
9mo ago
I feel like C people, out of anyone, should respect the code gen wins of defer. Why would you rely on runtime conditional branches for everything you want cleaned up, when you can statically determine what cleanup functions need to be calle
739.
▲
by
mort96
9mo ago
Then what's different other than the names of the branches?
740.
▲
by
mort96
9mo ago
Which is why people who understand color tend to add a bit of green in to make a color which still looks deep blue but is much brighter than what #00f looks like
741.
▲
by
mort96
9mo ago
Running a software project means making choices. Currently, the choice is made to make blue text unreadable. That's not a great choice, in my opinion.
742.
▲
by
mort96
9mo ago
If I was the maintainer of a terminal emulator, I would see a quite obvious way to improve the situation for my users: change the default colors so that dark blue is brighter. There's no obvious way to unilaterally improve the situatio
743.
▲
by
mort96
9mo ago
What's the difference between what you describe, and continuously merging things into main and cutting releases from a branch called stable?
744.
▲
by
mort96
9mo ago
If what they described is "trunk based development", then "git flow" is just "trunk based development where the trunk is called develop and there's a branch which always has the latest release". Is that it
745.
▲
by
mort96
9mo ago
I agree. I always customize the blue color on my terminal because dark blue on black is completely unreadable to me (and I'm not even color blind!). For some reason, every single terminal emulator defaults to a blue that's unreada
746.
▲
by
mort96
9mo ago
What's Apple's incentive for having two different asset pack formats? It seems like more work to support parsing and generating both, and Apple expects you to use their tools to generate asset packs. Working with binary files real
747.
▲
by
mort96
9mo ago
Easier for the developer or easier for the computer? Computers need to do it a bunch for every program launch for every single user of macOS for decades. The developer just needed to write a generator and a parser for the format once. Would
748.
▲
by
mort96
9mo ago
Uh. You want to store assets in JSON? Why? You generally want asset packs to be seekable so that you can extract just one asset, and why would you want to add the overhead of parsing potentially gigabytes of JSON and then, per asset, decodi
749.
▲
by
mort96
9mo ago
The solution, if you want a production ready GUI, is to use a GUI toolkit which already has decent accessibility support. There aren't that many of those: .NET, AppKit/UIKit, SwiftUI, Qt, GTK, the web, wxWidgets (which is really j
750.
▲
by
mort96
9mo ago
How's the accessibility?
More ›