C++: Can you return values of 0 or 1 as false and true in boolean functions? -


can c++ bool functions return 0 false , 1 true so:

bool foo() {     return 1; }  bool foobar = foo(); 

?

yes, because 0 implicitly converted false , 1 (or other nonzero value) implicitly converted true.

not legal idea, however.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -