While going over infrastructure code, I found this:
return !!(fin.flags & FIN_ACCEPT);
Does this has a meaning other than two logical nots in succession?
!
is logical negation. !!
is logical negation applied twice.
It is typically used to normalise a boolean expression value to be either 0
or 1
.
It is used to turn a numerical value into a boolean value. For example:
a = 5;
a = !!a;
!(!a)---> !(!5) ----> !(0) ----> 1
a
will have value 1.