4 ms·
Reminded of that time I tried to sneak this ternary delight into FreeBSD src: if ((Lflag ? chown : lchown)(p->fts_accpath, s->st_uid, -1)) (voi
by inopinatus 2y ago
Reminded of that time I tried to sneak this ternary delight into FreeBSD src:
if ((Lflag ? chown : lchown)(p->fts_accpath, s->st_uid, -1))
(void)printf(" not modified: %s\n",
strerror(errno));
which relies on the function prototypes of the chown(2) and lchown(2) syscalls being otherwise identical.
- kjs3 2y agoThat's demented. I don't think I'd ever think to even try that in C. chef kiss
- jandrese 2y agoNothing says "I'm up to some shenanigans" than the ? : syntax in C.
- fuzztester 2y agoExcept for nested ones; even more fun.
- mmaniac 2y agoMaybe I'm crazy or maybe I'm too used to functional programming, but I don't see anything wrong with this.