Triple negative in While and If?

I found these lines in a sketch that supposedly works, and wondered what the three "!" signs were for:

while(!!!client.available() && (timeout-- > 0)){

if(!!!client.available()) {

Does it mean "really, really NOT"? Would one "!" do just as well?

Is this just to make it readable, and it's going to be optimized away anyway?

That’s just redundant. One ! Would do.

Sometimes you’ll see it doubled. !! What that does is it makes any non-zero value into a 1. So the firat not makes anything non-zero into zero and anything zero into 1. The second not turns the 1 back to a zero and the zeros (that were any non-zero value) become 1.

But with three nots it’s just redundant. That doesn’t do anything useful.

the double bang such as !!x really helps semantically make the type of an expression a truth value (boolean) — technically 0 or 1 indeed — but semantically false or true.

You do that when you are too lazy to write (x != 0) (if x is a number type)

The triple bang is useless as it's the same as one bang - which gives you already a truth value.

Some programmers still use the triple bang to denote their intent as sometimes it's hard to see just a ! in front of a variable and you know the optimizer will get rid of it... so they see this as a way to visibly document what they really want... (I find it lame)

Thanks for the clarifications. I think I'll take them back to one.

One way to make a single ! visible is to put a space after it:

if (! client_available() && timeout-- > 0)


Indeed - or to use not instead of !