Hacker Newsnew | past | comments | ask | show | jobs | submit | unwind's commentslogin

Meta: a space is missing in the title.

Since this is one of the bugs, I always recommemd writing

    game->boardPieces = swAlloc(sizeof(ThingHandle*) * row * column);
Like this instead:

    game->boardPieces = swAlloc(sizeof *game->boardPieces * row * column);
It's not 100% better, but it cuts out a few tokens which helps readability and moves the significant asterix further left where I think it's easier to spot.


It's totally true, using sizeof like a function is one of my pet peeves. Even the kernel people do it but it's WRONG and you are right.

But ACSHUALLY, how you write allocation is like this

    #define sane_alloc(type, count) ((type *) malloc(sizeof (type) * (count)))

    game->boardPieces = sane_alloc(BoardPiece, row * column);
The kernel people seem to finally have figured out this one in 2026.


Nothing is sane in a language that lets you say 4["Foo!"]

Array indexing in C is just pointer arithmetic wearing Groucho Marx Glasses.

C combines the flexibility and power of assembly language with the user-friendliness of assembly language.


> Nothing is sane in a language that lets you say 4["Foo!"]

I just had a look at your HN profile page and was struck by the irony of seeing your Forth vs Lisp vs Postscript code examples there. Now consider that I've never written code like 4["Foo!"], even though I know it's possible, but in other languages you constantly have to do mental gymnastics to get any real work done, and those are allegedly so much saner !???


When they were handing out brains, I though they said suᴉɐɹq, and I said "180 rotate".


Nah I'm still against repeating the type name all over the place, and the cast adds nothing good imnsho.


The cast is at least 50% of why this is useful! You'll now get compile errors in case you did anything wrong.


Honestly, I think I'm more likely to get your form wrong than the original one. This doesn't obviously look wrong to me:

   game->boardPieces = swAlloc(sizeof game->boardPieces * row * column);
Maybe I find this harder to parse because I'm not used to sizeof without brackets (though I know it's valid). But I think the bigger deal is that your version has a bug if the star is missing whereas there's has a bug if the star is present; it's easier to spot something extra than it is to spot something missing.


> Meta: a space is missing in the title.

I like the word "everybug" :-D


Frankly, "sizeof(T*)" should generate a warning if T is anything other than void, or a function type.

Yes, I know that C technically allows rather heterogenous representations for pointers to different types, but in practice there is difference only between object pointers and function pointers.


Meta: confusing typo in title. Mods , please fix penciN -> penciL. Thanks.


Fixed, thanks!


Can you elaborate on how it detects and signals if it runs out of output buffer space? I couldn't see how the amount of available space was even communicated to `fc_enc()`.

Also there some "C icks" (to me, I'm very picky and used to know the standard awfully well from answering many SO questions) that you might want to look into. The two I remember now are the casting of `void` pointers from allocation functions, and (worse) the assumption that "all bits zero" is how a NULL pointer is represented.



Meta; typo in title, should be "learNEd".


Quality *Learing* Center 1-800-FRAUD


This is fantastic, thank you for doing this. I hadn't thought of the poor Jaguar in ages! Heh.

Found a tiny typo, this sentence from quite early (page 17):

Notice how apparently wasteful this file format is: some of the triplets contain only byte.

I think the word "one" is missing before the final "byte".


Fun post! Very happy to see a 20-something year old find and fix bugs in an X11 wm from before they were born. Gives me hope.

There was some kind of editing snafu though, the loop header in the big (first) code block reads:

    for (i = 0; i < 10; i++, nuke_count++)
But the references to it in the text, and updated versions in the patches, show it as just

    for (;;)
That was confusing me a bit.


In the article just before that code:

The loop is of paticular interest to us. Abridged:


How about "R, G, B Mars" [1], then?

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


As a ultra noob in the art of knotting, I liked this when I stumbled over it a few weeks back. I agree that for newbies it would be even more instructive with smoother flows, I guess they're held back by the animations being photos and not, well, animations.

I also have read their backstory/naming thing [1] several times but I still don't quite get it. I first thought they were related to the historical Grog, but that was a misunderstanding. I think.

[1]: https://www.animatedknots.com/grog-story


Meta: This is a very messy title, it should just be "The minichord: a pocket-sized musical instrument" or something like that. We have the github info in the auto-generated blurb right after the title, after all. Thanks.


Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: