HNHacker News
TopNewBestAskShowJobs

unwind

12,395 karma · joined March 23, 2009

Bearded hacker from Sweden. Learned M68k assembly on the Amiga in the late 80s. Compiling C on a 7 MHz CPU was slow. Working as a contracting software developer since almost 10 years, enjoying visiting various parts of the software world.

I hang out a lot on Stack Overflow: http://stackoverflow.com/users/28169/unwind, mainly answering questions about C. I love C.

submissionscomments
unwind··on The Lost Machine Automats and Self-Service Cafeterias of NYC (2023)
Interesting, did some light (heh) digging.

[1] agrees that World War II-era luminous materials featured radium, yes. Another use seems to have been putting discs on helmet fronts of paratroopers, to help soldiers see each other in the dark.

This page [2] has a picture of a variety of luminous products from the era, and also mentions one civilian usage was marking edges of clothing, also to help make pedestrians more visible in the (blacked-out) streets.

I'm rather low on the Interest in History scale, but it's fascinating how often WW2 manages to deliver something new. Thanks.

[1]: https://www.paratrooper.be/articles/luminous-disks/

[2]: http://www.butterflybalcony.com/2013/10/the-home-front-black...

unwind··on Dollar-stores overcharge customers while promising low prices
The article touches on this:

All told, 69 of the 300 items came up higher at the register: a 23% error rate that exceeded the state’s limit by more than tenfold.

This implies that an error rate of perhaps 2% would be legal. I haven't checked, but I guess Europe has something similar even though I'm quite certain that retailers have to sell things at the posted price if there's a mistake.

Part of the problem seems to be that the maximum fine (at least in the state in the article) is "too low", so retailers don't have an incentive to keep price tags correct since they profit from the error and even if they're fined it's still better (economically) for them to charge more than the price tag. I wonder how much lobbying has happened to keep fines low ...

unwind··on The C++ standard for the F-35 Fighter Jet [video]
For C, the proper/expected/standard way to reference a variable without accessing it is a cast to void:

    (void) a;
I'm sure there are commonly-implemented compiler extensions, but this is the normal/native way and should always work.
unwind··on Multivox: Volumetric Display
I think it's worth pointing out that "in operation" here means it's running Doom. Which I was not expected, and somewhat blown away (heh) by. Very very cool.
unwind··on What is better: a lookup table or an enum type?
I don't database, but I like to think I have some kind of intuition for storage space requirements, and this article was very confusing.

Ignoring the indexes and just focusing on the main table sizes reported, we have:

- String ("The frequent repetition of these names inflates the size of the table"): 392 MB

- Enum data type ("Internally, an enum type is stored as four-byte floating point number. So it saves space in the table [...]"): 338 MB

- Lookup table ("Also, since a smallint only occupies two bytes, the person_l table can potentially use less storage space than the other solutions"): 338 MB.

I just can't make sense of the numbers, especially given the authors comments that I've quoted.

Is this some kind of typo/editing fail?

unwind··on Addressing the adding situation
Not in C no, since arithmetic on a pointer is implicitly scaled by the size of the value being pointed at (this statement is kind of breaking the abstraction ... oh well).
unwind··on Spleen Monospaced Bitmap Fonts
TIL the term "throw-up", thanks!

It's weirding me out that Wikipedia's page features graffiti of the word ... SPLEEN to illustrate [1]. Wut.

[1]: https://en.wikipedia.org/wiki/Throw_up_(graffiti)

unwind··on Engineers repurpose a mosquito proboscis to create a 3D printing nozzle
This is cool and great and all, but isn't it a bit ... stretched to motivate this by the fact that the nozzle is biodegradable?

I mean for a printing nozzle with an inner diameter of 20 µm, how much material would be wasted if it was made out of plastic or metal? I get that no such nozzle is available and/or easily made, but shouldn't that be the point of the invention, rather than "yay, it's biodegradable so we save a microgram of plastic/metal"?

unwind··on Implementing Bluetooth LE Audio and Auracast on Linux Systems
This:

If you've ever wondered why your music quality drops dramatically when you answer a call on your Bluetooth® headset, you've experienced one of A2DP's key limitations firsthand.

Made me feel old ... how are people listening to music while taking a call?

unwind··on Vsora Jotunn-8 5nm European inference chip
It loaded fine for me, but that slash before the unit was a bit smelly. :| Just a tiny edit, but it's a rather core part of their message so they should probably notice and format it correctly before publishing.
unwind··on Rethinking C++: Architecture, Concepts, and Responsibility
The article argues that modern C++ has type-checked string formatting, so it does not argue for (unchecked) `printf()`, right?
unwind··on The feds want to make it illegal to even possess an anarchist zine
According to Wikipedia, the writing was (mostly?) by Brian Reynolds [1]. There's an interview [2] which is linked to by the Wikipedia page about the game [3].

[1]: https://en.wikipedia.org/wiki/Brian_Reynolds_(game_designer)

[2]: https://web.archive.org/web/20050221102608/http://pc.ign.com...

[3]: https://en.wikipedia.org/wiki/Sid_Meier%27s_Alpha_Centauri#I...

unwind··on Git 3.0 will use main as the default branch
Tip: the next time you need to name a function, don't use "a stupid word that doesn't say much about anything". That's not how you're supposed to name stuff in programming. :)
unwind··on Show HN: I wrote a minimal memory allocator in C
This looked nice and simple, appreciated!

A couple of minor C points:

- The code seems to completely lack use of `static` for things that should be local to the implementation, such as `META_SIZE`, `find_free_block()` and others.

- The header includes `<stdbool.h>` but the interface doesn't use it so it could be included in the C file instead (which, in fact, it is!).

- Could do with more `const` for clarity, but that is quite personal.

- Interesting to use explicit comparison to check for integers being zero, but treat pointers being NULL as implicit boolean. I prefer comparing in both cases.

unwind··on Show HN: F32 – An Extremely Small ESP32 Board
Me too, but that particular picture was confusing. Shouldn't the board be with the human, 120 ft from the wifi access point being connected to? Now it looks as if the human screams at the board from 120 ft away, or something.

Other than that, hugely impressive project of course, it makes any board I've tried to design/assemble look impossibly huge. :)

unwind··on Show HN: Reversing a Cinema Camera's Peripherals Port
Neat! It's great when old hardware can be made better and given new features (and extending the life-span) by semi-simple means like this. It's also amazing to see how often a 3D printer pops up in these projects, nowadays.

This paragraph stood out a little to me:

We only need two pins (which the STM32 is total overkill for): GND and a GPIO. The only thing really making this harder than just turning it on/off is that we need to both read the voltage and write it but this protocol is so slow you can literally just change the type on the fly lol—or as we are doing, just making it both an in- and output.

There's like two levels of semi out of the box thinking here: one is the solution the OP came up with, the fact that even if a pin is in output mode, the input circuitry often still just works so you can read the pin. The other is of course to connect the signal to one more external pin (the OP even made a point of there being a huge abundance of pins) and program that as a permanent input (electrically I believe this is safe, inputs are high-impendance, but a series resistor wouldn't hurt for semi-low speed signals as far as I know).

unwind··on Where do the children play?
By the way the rest of the (actual) saying that is the title for the Swedish book is "Only Bad Clothes". In Swedish it rhymes [1] which of course increases its power. I know it from when I was a kid 40+ years ago, and I think both my kids would recognize it or at least get the meaning.

That being said, obviously mobile phones etc are huge and (in my opinion) problematic among kids here, too.

[1]: https://www.reddit.com/r/Svenska/comments/vj2630/no_such_thi...

unwind··on Laptops with Stickers
Somewhere I have a "RUN GCC" sticker from the Free Software Foundation that I was given by Daniel Stenberg (author of curl) at some meetup here in Stockholm.

That would actually be kind of cool, I always end up not being able to make up my mind about what would be worthy.

unwind··on Drawing Text Isn't Simple: Benchmarking Console vs. Graphical Rendering
Meta: this is kind of a repost, not even a month since last time [1].

[1]: https://news.ycombinator.com/item?id=45580559

unwind··on Myna: monospace typeface designed for symbol-rich programming
Repost, see https://news.ycombinator.com/item?id=45849342.
unwind··on The Linux Kernel Looks to “Bite the Bullet” in Enabling Microsoft C Extensions
Huh. I thought the article was vague on what exactly these extensions permit, so I'd thought I'd look up the GNU documentation. Surprisingly, it [1] was rather vague too!

The only concrete example is:

Accept some non-standard constructs used in Microsoft header files.

In C++ code, this allows member names in structures to be similar to previous types declarations.

    typedef int UOW;
    struct ABC {
      UOW UOW;
    };

[1]: https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#in...
unwind··on Patching 68K Software – SimpleText
I believe the reasoning for the "Intel style" ("op dst, src") is that it reads more like "dst = src" which is how it's written in higher-level languages.
unwind··on A Fond Farewell
Nobody posted [1] yet, it feels like it's needed.

[1]: https://en.wikipedia.org/wiki/Long_Now_Foundation

unwind··on Patching 68K Software – SimpleText
For people not used to reading MC8k assembly [1], it's helpful to point out the basic fact that the syntax is in general

    opcode  source, destination
which is the other way around from most contemporary ISA:s. So a line like

    move.l d0, -(a7)
will first decrement the value of register a7, then write the contents of register d0 to the resulting address (it's a "push" for a downwards-growing stack).

Edit: added Wiki-linkage.

[1]: https://en.wikipedia.org/wiki/Motorola_68000#Instruction_set...

unwind··on Bluetui – A TUI for managing Bluetooth on Linux
My understanding is T for text-based [1], the term is used about e.g. DOS programs too where the text interface is not historically called a terminal.

[1]: https://en.wikipedia.org/wiki/Text-based_user_interface

unwind··on Rust cross-platform GPUI components
That showcase application (other than Zed) looks awesome, but the very fancy-looking home page [1] fails to have a one-liner explanation of, uh, what the application does. Please consider fixing.

[1]: https://longbridge.com/desktop/

unwind··on Wasp Blower
If you have (young) kids, having active/plentiful wasps nearby might just not work. Wasps can be scary, especially to children who have been stung before, and they are super-impractical around kids eating/snacking, too. "Close your mouth and relax" just doesn't get through to a scared kid, in my experience. :|
unwind··on Binmoji: A 64-bit emoji encoding
Cool!

I've not had enough coffee to deeply understand this, some parts seem like magic and I'm not sure if the hashing is sufficient.

Anyway, I am eminently nerd-snipable when it comes to reviewing C code, so here are a few comments. Do with them as you wish obviously.

1. C89 is an interesting and slightly depressing choice, it would be interesting to hear one platform where this library would be relevant that lacks at least a C99-compliant compiler.

2. On that note, I don't think `uint32_t` and friends are in C89, so that's a bit strange. Many compilers seem to allow it anyway, but then your code is no longer C89-compliant, of course.

3. I think the constant `num_hash_entries` pollutes the global namespace, it's not `static` and has no prefix.

4. In the header there is the `USER_FLAG_MASK` which is static, but will also clobber any application-defined symbol of the same name. Consider prefixing it.

4. In general please consider writing

    memset(binmoji, 0, sizeof(struct binmoji));
as:

    memset(binmoji, 0, sizeof *binmoji);
it's less error-prone (since it "locks" the cleared size to the actual type of the variable used) while being shorter and typographically less involved.

5. The repeated bitwise-OR:ing in `binmoji_encode()` has extra parentheses on each of the lines.

6. Awesome to see use of `bsearch()` to reduce risk of binary-search bugs.

unwind··on VST3 audio plugin format is now MIT
Yeah, I realized that once I finished writing my comment, that it might be about communicating with the UI since UI toolkits are usually not thread-safe enough. Thanks.
unwind··on Rivian's TM-B electric bike
Oh: I was surprised/saddened that the article mentioned Cake's bankruptcy, so I had to check and it seems the company/assets and a lot of staff was acquired by Norwegian company Brages [1] so it kind of still exists, at least. Not sure if that means they no longer sell in the US, though.

[1]: https://ridecake.com/en-SE/the-cake-journey-continues

← PreviousPage 3 of 34Next →