I am trying to understand code of some library of one simulation tool that i use.. It has the following line:
propData->fadingStretchingFactor =
(double)(propProfile0->samplingRate) *
propProfile->dopplerFrequency /
propProfile0->baseDopplerFrequency /
(double)SECOND;
Now how do u figure out the order of operations if there are two consecutive division operators as in this example
Division is left associative. a / b / c
is equivalent to (a / b) / c
.
Note that C (and C++) do not guarantee any ordering between the evaluations of the terms a
, b
, and c
. For example, foo() / bar()
could call foo()
before bar()
or foo()
after bar()
.
The grouping of operations of equal precedence is determined by operator associativity .
In C++, division is left-associative , which means that the leftmost operation is grouped first, ie:
a / b / c
is the same as:
(a / b) / c
Left to right associativity
http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.