comma operators problem in function call

Started by
2 comments, last by King Mir 17 years, 10 months ago
http://c-faq.com/expr/comma.html FAQ say ...but the commas separating the arguments in a function call are not comma operators.... What are they then??
Advertisement
They're just argument separators. Nothing magical going on here.

(If for some reason you did want to invoke the comma operator within a parameter list of a function call, use an extra pair of parentheses around the things to be comma-operator'd.)
Quote:Original post by Zahlman
They're just argument separators. Nothing magical going on here.

(If for some reason you did want to invoke the comma operator within a parameter list of a function call, use an extra pair of parentheses around the things to be comma-operator'd.)


For clarity of code sake, however, such juicy syntax is probably best avoided. [wink]
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man
It's actually an important point to remmember though. It means that the following is undefined:
func(i++,i)

Whereas this is fine:
myVar=(i++,i)//same as myVar=++i

This topic is closed to new replies.

Advertisement