[En-Nut-Discussion] ANSI/ISO C, was: definitons for fcntl.h

Harald Kipp harald.kipp at egnite.de
Tue Nov 23 17:08:32 CET 2004


Pavel,

I'd not consider an expression like
   !(val & 1)
to be wrong. But in my view it's an indirect
statement of what directly should have been
   (val & 1) == 0
Using the '!' here isn't that bad. IMO it's neither nice.

May be with expressions this does look OK to most people.
But reading verbatim
   if(!ReturnZeroOnSuccess())
instead of
   if(ReturnZeroOnSuccess() == 0)
regularly catches me.

I admit, however, that I never use
   if(ReturnZeroOnSuccess() != 0)
but prefer
   if(ReturnZeroOnSuccess())
which may look inconsequent.

Right, it's a matter of personal preferences, for which I
can try to get support. Otherwise it's no problem to accept,
that others have good reasons to prefer the short form with '!'.

So, no big deal. But the best about all this is, that
we received your most interesting explanations.

Thanks,

Harald




More information about the En-Nut-Discussion mailing list