M
mr.gsingh
My program looks something like this:
int x = 23;
if ( (func(x), func1(x), func2(x)) <= (foo(x), foo1(x), foo2(x)))
{
std::cout << "............";
}
else
{
std::cout<< "..............";
}
where func(x), func1(x) and func2(x) return reference to 'x' and foo(),
foo1() and foo2() return integer. I understand this is bad programming
but I am doing this to understand the execution semantics of comma
operator.
g++ gives me the follwoing execution order:
Function foo.
Function foo1.
Function func.
Function func1.
Function func2.
Function foo2.
This looks weird to me. I was expecting s'thing like
func, func1, func2, foo, foo1, foo2
Any explanations for this behavior will be highly appreciated.
Thanks
Gagan
int x = 23;
if ( (func(x), func1(x), func2(x)) <= (foo(x), foo1(x), foo2(x)))
{
std::cout << "............";
}
else
{
std::cout<< "..............";
}
where func(x), func1(x) and func2(x) return reference to 'x' and foo(),
foo1() and foo2() return integer. I understand this is bad programming
but I am doing this to understand the execution semantics of comma
operator.
g++ gives me the follwoing execution order:
Function foo.
Function foo1.
Function func.
Function func1.
Function func2.
Function foo2.
This looks weird to me. I was expecting s'thing like
func, func1, func2, foo, foo1, foo2
Any explanations for this behavior will be highly appreciated.
Thanks
Gagan