3 ms·
This thread is the first time I hear people say that the bangbang boolean cast "operator" is poor coding. It's very idiomatic in my experience and it doesn't gi
by simias 11y ago
This thread is the first time I hear people say that the bangbang boolean cast "operator" is poor coding. It's very idiomatic in my experience and it doesn't give me pause at all.
I mean, if it's forbidden by your particular coding style then fair enough but it's a bit harsh to cry at this bit of code because it makes use of it.
For what it's worth I made a quick grep for ' !!' in the linux kernel and found 2439 matches. I think it's more a matter of subjective taste than a sign of poor coding.
And I maintain that any C compiler worth its salt will handle '!!' just fine, it's a really simple optimization (and even if you consider double-negations poor style in your code it'll crop up quite often while inlining functions or expanding macros for instance).