Look what I found
-
@error That's super neat, I didn't know! I'll probably use this in my code at a some point...
@vaporeon_ please don't

-
Look what I found
@error I don't think I ever would have tried to pass that off, myself, but I sort of admire the fact that, even though it's language abuse, it produces a predictable outcome. C has a lot of undefined behavior, but somehow, this isn't.
I think I tried to use Duff's Device in a project once, but my colleagues objected and made me change it. Or maybe I just explained Duff's Device to them and they were horrified. Like, "I don't know if I can trust that guy anymore" horrified. It was a long time ago.
This is interesting but it's not really saving a ton of time or code space. I think Duff's Device is probably more defensible.
-
Look what I found
-
@error yup that's how Contiki implemented Protothreads initially:
-
@error I don't think I ever would have tried to pass that off, myself, but I sort of admire the fact that, even though it's language abuse, it produces a predictable outcome. C has a lot of undefined behavior, but somehow, this isn't.
I think I tried to use Duff's Device in a project once, but my colleagues objected and made me change it. Or maybe I just explained Duff's Device to them and they were horrified. Like, "I don't know if I can trust that guy anymore" horrified. It was a long time ago.
This is interesting but it's not really saving a ton of time or code space. I think Duff's Device is probably more defensible.
@WesternInfidels It produces warning, so I personally won't use it. But it looks beautiful
-
Look what I found
@error reminds me of duff’s device https://en.wikipedia.org/wiki/Duff%27s_device
-
-
Look what I found
@error time to see who at my workplace I can aggravate the most
-
Look what I found
@error yes -
Look what I found
@error this is devious and i love it -
Look what I found
@error musl does this in its printf implementation: https://git.musl-libc.org/cgit/musl/tree/src/stdio/vfprintf.c#n597
-
Look what I found
@error wow it does not even -Wextra the nested labels
-
switches are just polyamorous gotos
@gloriouscow @error the important part is the boundaries tbh
-
Look what I found
-
you can find more here:
https://hachyderm.io/search?q=%22Cursed+code+of+the+day%22&type=statuses
-
@mikee I actually tried it. It works just fine to my surprise. But the clangd formatter gone mad:
-
Three lines too many. I thought serious programmers were lazy.
@KingmaYpe @error I think this one falls under increasing job security by writing code nobody else understands how to work with
-
Look what I found
@error this will infest my nightmares.
-
@shafik WHATDA...
Hm -
@error musl does this in its printf implementation: https://git.musl-libc.org/cgit/musl/tree/src/stdio/vfprintf.c#n597
@koorogi so, in case 'm', we just skip the first line of the next case and go straight to the line 600. Ok
Without {} it reads easier, I'd say