▲ 602 ▼ no cap (lemmy.ml) submitted 3 years ago by gpw@lemmy.ml to c/programmerhumor@lemmy.ml 33 comments fedilink hide all child comments
[–] db2@sopuli.xyz 23 points 3 years ago* (last edited 3 years ago) (3 children) Does it make me a bad person that I like this? Edit: wait.. return ! 0 ; wtf Edit 2: idc still like it frfr no cap permalink fedilink source hideshow 3 child comments replies: [–] grue@lemmy.ml 5 points 3 years ago (1 child) Edit: wait… return ! 0 ; wtf I mean, returning non-zero exit status on error is just good practice. It even managed to evaluate to the same numerical value as EXIT_FAILURE when I tested it on my machine (gcc 11.4.0 linux x86-64), although I'm not sure if that's always the case or if it's undefined behavior. This cursed code is quite well-written. permalink fedilink source parent hideshow 1 child comment replies: [–] bronzle@lemm.ee 5 points 3 years ago !0 is defined as 1, that’s how argv [ no cap ] works, that and the ridiculous argc check stood out as a bit off, but works permalink fedilink source parent [–] SnowdenHeroOfOurTime@unilem.org 1 point 3 years ago Yes. permalink fedilink source parent
[–] grue@lemmy.ml 5 points 3 years ago (1 child) Edit: wait… return ! 0 ; wtf I mean, returning non-zero exit status on error is just good practice. It even managed to evaluate to the same numerical value as EXIT_FAILURE when I tested it on my machine (gcc 11.4.0 linux x86-64), although I'm not sure if that's always the case or if it's undefined behavior. This cursed code is quite well-written. permalink fedilink source parent hideshow 1 child comment replies: [–] bronzle@lemm.ee 5 points 3 years ago !0 is defined as 1, that’s how argv [ no cap ] works, that and the ridiculous argc check stood out as a bit off, but works permalink fedilink source parent
[–] bronzle@lemm.ee 5 points 3 years ago !0 is defined as 1, that’s how argv [ no cap ] works, that and the ridiculous argc check stood out as a bit off, but works permalink fedilink source parent