Monday, July 05, 2004

c/c++ undefined behaviour

http://www.swansontec.com/sopc.htm

they call it "side effects"

IMP : order of evaluation for function arguments is unspecified
therefore the below expression is undefined
f(n++, n);

the order is not defined for =, first ++, second ++
*p++ = *q++

"sequence point" comes into picture. A sequence point is any point in a program's execution wherein all side effects of previous evaluations are complete and no side effects of subsequent evaluations have started. a ; / () / , / && / || etc can be sequence points.

IMP: the commas that separate the arguments in a function call are not comma operators