2 ms·
I'm not a C developer at all, but this looks like bragging about a clever trick; when it comes to these things (and most code for that matter), I'd avoid clever
by Cthulhu_ 4y ago
I'm not a C developer at all, but this looks like bragging about a clever trick; when it comes to these things (and most code for that matter), I'd avoid clever tricks like the plague. Just write it out logically and as simple as possible. You're not saving much time / effort by writing out, and clear is better than clever. Code size is never an issue.
- stathibus 4y agoSeriously, in what dimension is this a good choice?
- TheDong 4y agoProgramming is meant to be fun. That sounds like it was fun. For some projects and people, fun is more important than readability, speed, or any other dimension. (edit: not to imply that hack isn't readable or fast or such! I think it's cute and very readable)
- ghosty141 4y agoSerenityOS is not production software or used for anything serious. Its just for fun.
- Y_Y 4y agoIt's fun though. It's nice to have "best practices" etc, but SerenityOS isn't for IBM calculators or NASA life-support systems, it's a project for enjoyment by people who enjoy writing software.
- 0xfedbee 4y agoYou’d understand it if you were a C developer.
- tredre3 4y ago> You’d understand it if you were a C developer. Counterpoint: I'm a C developer and a big fan of Andreas and I prefer mildly clever code over longer explicit code. But even then I was still surprised by his choice to keep this specific hack. It feels very brittle to me.