Jump to content
  • Advertisement
Sign in to follow this  
Japanese

comma operators problem in function call

This topic is 4421 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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??

Share this post


Link to post
Share on other sites
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.)

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!