12,395 karma · joined March 23, 2009
I hang out a lot on Stack Overflow: http://stackoverflow.com/users/28169/unwind, mainly answering questions about C. I love C.
I love seeing new games for "retro" machines, it's awesome that people keep pouring time and love into them after all these years.
I'm not super familiar with 8-bit Atari machines, and found the designation "classic unmodified 8-bit ATARI XL/XE" a bit imprecise. Tried looking up specs on Wikipedia [1] but was unsure what to settle on. Perhaps the original 1200XL would match? Or the 800XL which seems to improve on the 1200XL even though the naming suggests the opposite ... Or the 65XE, or both then I guess since the latter is compatible with the 800XL, but in an updated case?
[1]: https://en.wikipedia.org/wiki/Atari_8-bit_computers#1200XL
If my math is right it seems the cost in material for the printed part is around $5 which seems ridiculously cheap for a custom-designed and adapted solution like this. Nice!
I wish the author had spent a few words extra to motivate why it needs to be in PETG filament for "heat resistance", is the regular PLA limit of ~55 degrees Celsius not okay for a desktop accessory? I guess if it's in direct sunlight that might be exceeded, or perhaps if the laptop runs very hot?
It turns out that there are various models for the number of continents, and that is (phew) known in Spanish, too. See the Wikipedia page [1] (link to Spanish version) for instance. This is for European Spanish though, but I couldn't find a version of the page in es-AR.
[1]: https://es.wikipedia.org/wiki/Continente#Modelos_continental...
But this really is a stretch:
The Z80 Membership Card itself is a stand-alone single-board computer that can "power up" your projects, like the Parallax BASIC Stamps or Arduino microcomputers.
Both of those are very commonly called microcontrollers, not microcomputers, since they have all of those extra chips merged into the single package of the CPU.
Take a look at the Arduino Uno [1] which is a very typical (if old) example: you will see that the board is not covered in ICs from edge to edge, since all of the main functionality is in the single-chip microcontroller. I think the second big-ish package visible is for the USB, but that also disappears on more modern controllers with on-board support for USB.
[1]: https://en.wikipedia.org/wiki/Arduino_Uno#/media/File:Arduin...
I did find the projects "user-facing" home page [1] which was nice. I found it rather hard to find a link from that to the code on GitHub, which was surprising.
I remember being upset since he claimed I failed to even point out Dr Pepper, which I still think is unbelievable since even its smell is super distinctive and way different from a cola.
[1]: https://www.mitti.se/nyheter/buset-pa-kungsgatan--butiken-bl... is the same store, article (in Swedish) about a recent prank someone did there
I was worried (I find it confusing when Unicode "shadows" of normal letters exist, and those are of course also dangerous in some cases when they can be mis-interpreted for the letter they look more or less exactly like) by the article's use of U+212A (Kelvin symbol) as sample text, so I had to look it up [1].
Anyway, according to Wikipedia the dedicated symbol should not be used:
However, this is a compatibility character provided for compatibility with legacy encodings. The Unicode standard recommends using U+004B K LATIN CAPITAL LETTER K instead; that is, a normal capital K.
That was comforting, to me. :)
According to Google's built-in exchange rate calculator it should say $235m.
I think the term is/was originally a product name for a small, rectangular module with a stepper motor driver on it [1] from 2012. Then it seems the term has been made more generic, with updated versions like the SilentStepStick [2] featuring a driver chip by Trinamic instead.
I guess my point is that for some readers, the stepper motor features on OP's board could be made more clear and perhaps use actual chip numbers, too. :)
Great job!
[1]: https://wiki.geeetech.com/index.php/StepStick_A4988_Stepper_...
Here [1] is a page at Klover, and here [2] is one at Shure. Not sure if there's a formal specification for this, or if it's just something that manufacturers started doing.
[1]: https://www.kloverproducts.com/blog/what-is-plugin-power
[2]: https://service.shure.com/s/article/difference-between-bias-...
Yes, the `static` can simply be dropped, it does no additional work for a single-file snippet like this.
I tried diving into Compiler Explorer to examine this, and it actually produces slightly different code for the with/without `static` cases, but it was confusing to deeply understand quickly enough to use the output here. Sorry.
Therefore it's very jarring with this text after the first C code example:
This uses a static variable to have it persist between both the compare function calls that qsort makes and the main call which (potentially) changes its value to be 1 instead of 0
This feels completely made up, and/or some confusion about things that I would expect an author of a piece like this to really know.
In reality, in this usage (at the global outermost scope level) `static` has nothing to do with persistence. All it does is make the variable "private" to the translation unit (C parliance, read as "C source code file"). The value will "persist" since the global outermost scope can't go out of scope while the program is running.
It's different when used inside a function, then it makes the value persist between invocations, in practice typically by moving the variable from the stack to the "global data" which is generally heap-allocated as the program loads. Note that C does not mention the existence of a stack for local variables, but of course that is the typical implementation on modern systems.
Also, the use of a convoluted `if` to conditionally assign a literal boolean is a code smell (to me), I would drop the `if` and just use:
in_reverse = argc > 0 && argv[1][0] == '-' && argv[1][1] == 'r';
if a more forward-thinking/strict check is not needed.I vaguely remember a reference to some balance game as the origin story for the Guru Meditation, but that was so long ago and I never looked it up!
Meta: it would have been nice to include this reference in the submission title, since it's least as interesting as the fact that the peripheral was for the Atari 2600. Something like "The Joyboard: Atari 2600 balance peripheral that inspired Guru Meditation", perhaps. Probably too late now, and this is not exactly tearing down the front page, anyway. :)
Thanks!
It's not possible to know C code and think that
sizeof *v
and sizeof v
somehow mean the same thing, at least not to me.----
This:
struct Vec3* v = malloc(sizeof(struct Vec3));
is better written as: struct Vec3 * const v = malloc(sizeof *v);
The `const` is perhaps over-doing it, but it makes it clear that "for the rest of this scope, the value of this pointer won't change" which I think is good for readability. The main point is "locking" the size to the size of the type being pointed at, rather than "freely" using `sizeof` the type name. If the type name later changes, or `Vec4` is added and code is copy-pasted, this lessens the risk of allocating the wrong amount and is less complicated.----
This is maybe language-lawyering, but you can't write a function named `strclone()` unless you are a C standard library implementor. All functions whose names begin with "str" followed by a lower-case letter are reserved [1].
----
This `for` loop header (from the "Use utf8 strings" section:
for (size_t i = 0; *str != 0; ++len)
is just atrocious. If you're not going to use `i`, you don't need a `for` loop to introduce it. Either delete (`for(; ...` is valid) or use a `while` instead.----
In the "Zero Your Structs" section, it sounds as if the author recommends setting the bits of structures to all zero in order to make sure any pointer members are `NULL`. This is dangerous, since C does not guarantee that `NULL` is equivalent to all-bits-zero. I'm sure it's moot on modern platforms where implementations have chosen to represent `NULL` as all-bits-zero, but that should at least be made clear.
[1]: https://www.gnu.org/software/libc/manual/html_node/Reserved-...
[1]: https://dutchreview.com/dutch-quirks/dutch-quirk-107-eat-foo...