Skip to content

Comment on The code that lived in my head rent free for 30 years

Comments

Very similar to programming micro controllers, a lot of setting registers to arbitrary values to toggle certain bits high or low to enable/disable device functionality or set some interrupt or other. You needed the data sheet as well as the code to work out what was going on.

Oh yes, a good example is setting a magic value to a registry [1] to make sure your microcontroller (in my case, an ESP32-S3) wouldn't reboot because of the watchdog.

At first, I was confused on the behavior - after reading the datasheet and setting the magic value, it all made sense. I'm pretty sure it will look like wizardry to the next person looking at the magic value alone.

Thankfully code comments are a thing, but magic values are still magic values.

[1]: https://github.com/tinygo-org/tinygo/pull/3937/files#diff-8f...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.