I was wondering if there is any value in the part of the code that I see that includes
return (num!=0);
where num is int. And this is the return statement of a boolean function that wants to return TRUE if num != 0and false if num = 0.
num != 0
num = 0
I am not sure if there is a hidden meaning for this, but I donβt see why they simply cannot just write:
return num;
Here is the code I saw:
bool SemClass::cut(int &a, int &b, int &c) { int num = 0; check(a, num); check(b, num ); check(c, num); return (num != 0); }
0 , null-- boolean . , 1, 2, 3, 4 .., true. C ; C .
boolean
: en.cppreference.com/w/cpp/language/implicit_cast
, ++, num num!=0 . num!=0 , . 0 , . num!=0, , true, num 0 false, .
num
num!=0
0
, , boolean, , . integer code/enum.
integer
, num!= num . . , integer, boolean.
num!=
, return num, . , , .
return num
return num, , num int, bool, (s), ( ++), , 0 -> false, anything else -> true. , ?
int
bool
0 -> false, anything else -> true
return num!=0, (s), , ( , ) , .
return num!=0
, , , ( ) . , , , (r-). ++ 20 , , , ( , ).
() :
.
++ bool: , false, true.
false
true
return num;, .
( , C int 1 0, true false).
Source: https://habr.com/ru/post/1628798/More articles:Application testing error on iOS 8.3: Testflight could not install the application. An error occurred with this request - iosCannot install applications from test flight. An error occurred with this request - iosPHP loading a file when an image is clicked - javascriptDjango ORM - confusion regarding Router.allow_relation () - pythonApply three CSS filters side by side on the image? - javascriptThe certificate has an invalid issuer: keychain - certificateError compiling c code in opencv on raspbian - cAvoid SQL injection using a non-parameterized query - c #Transferring data from one page to another in angular js - angularjsUsing tables with disabled comma - jqueryAll Articles