[nem-en] What about operator '!!' ?
Paul Bludov
pbludov at gmail.com
Tue Jan 23 02:37:05 CET 2007
A long time ago, nearly two lives before, I was a c++ coder.
And every time when I need to convert some integer (BOOL) or pointer (also
iuteger) to boolean (bool), I've used operator '!!'.
For example, instead of:
return (SomeFunctionCall() != NULL);
I wrote
return !!SomeFunctionCall();
wich is more readable and much shorter.
According to google, it is quite common technique:
http://www.google.com/codesearch?q=!!
Moreover, the compiler seems to be aware of them and translate to simple
'$expr != 0'
The implementation will be very similar to the '??' macro, except there will
be only one expression.
Is it a good or bad idea to make such macro for Nemerle?
More information about the devel-en
mailing list