DEV Community

Discussion on: Code Smell 51 - Double Negatives

Collapse
 
arose profile image
Antoine R

Unrelated, but from the title, I thought the article would be about the!! double negation operator, which gives a simple way to check if an integer is non-zero. In C:

return !!myInt; // returns 1 if myInt is non-zero
Enter fullscreen mode Exit fullscreen mode

That's a very basic trick, but I like it :)

Collapse
 
mcsee profile image
Maxi Contieri

That is another code smell!!

I will write about it soon

Collapse
 
arose profile image
Antoine R

Haha, I have to admit it's not the most readable piece of code :)

Thread Thread
 
mcsee profile image
Maxi Contieri

Funny thing. You already found out it smells :)