The C ++ comma operator is used to combine individual expressions, resulting in the result of the value of the last expression executed.
For example, skeletal code (6 operators, 6 expressions):
step1; step2; if (condition) step3; return step4; else return step5;
Can be rewritten to: (1 instruction, 6 expressions)
return step1, step2, condition? step3, step4 : step5;
I noticed that step-by-step debugging of such code is not possible, since the expression chain seems to be executed as a whole. Does this mean that the compiler is capable of performing special optimizations that are impossible with the traditional approach to description (especially if the steps are constant or inline)?
. ! , .
" ", / . : . , , . , , : , , . , , "", - . - , , " " , . .
, , . , - , , . , , , .
, , , , . " ", , , . , , , , . , - , " hokey-cokey", " , " .
, , ++ - , , , . ( , .)
, , , , - , . ( ? , my_func((++i, y), x).)
my_func((++i, y), x)
"" , , - for:
for
for (int i = 0, j = 0; i < 10 && j < 12; i += j, ++j) // each time through the loop we're tinkering with BOTH i and j { }
. / , , , , .
OTOH, , . , .;)
:
Source: https://habr.com/ru/post/1738852/More articles:Java / Thread Server Application Server - javaУстановить точку регистрации MovieClip в центр в AS3 - actionscript-3How can I effectively get a large number of database settings as PHP variables? - databaseHow to implement this mechanism: - pythonHaskell: преобразование целочисленного числа unicode в фактический символ Юникода - unicodeHow to check image quality in a program using C #? - c #Can I use the MAX function for each tuple in a dataset - sqlA cast-type array into a common array? - arraysexecuting a script from maven inside a project with multiple modules - javaBeginAnimations and CommitAnimations with NavigationController.PushViewController - uiviewAll Articles