3 ms·
Um 3 lines? That's not 3 lines. Sure it FITS into 3 lines but every time you see a ";" you also see a new line. So #define mu_run_test(test) do { char messa
by wheaties 17y ago
Um 3 lines? That's not 3 lines. Sure it FITS into 3 lines but every time you see a ";" you also see a new line. So
#define mu_run_test(test) do { char message = test(); tests_run++; if (message) return message; } while (0)
Isn't one line but
#define mu_run_test(test) do {
char *message = test();
tests_run++;
if (message)
return message;
} while (0
- steveklabnik 17y agoI don't think this is some grand conspiracy where this guy is going to slip a macro past us to make us think he's some super 1337 coder becauase I can count LOC on one hand. It's just that most people would see a #define as 1LOC. The semantics are a bit iffy becuase it's a macro, yes, but even then, okay, it's 12 LOC if you put in those extra lines. It's still tiny. His point about the simplicity of tests still stands.
- dkersten 17y agoWell, then, I'm going to start a blog series about "X in 1 LOC" and just mash everything into one line. If that doesn't work, I'll rename it to "X in 2 LOC" and put the code into a define, then use the define. Obviously I will be posting each and every port to HN. You downvote me now, but you'll be upvoting me when I make infinite amounts of money on my 2 LOC implementations of.. everything :-D
- steveklabnik 17y agoYou're still missing the point. It has nothing to do with the value of X, except that it's small.