Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 3
    Whoa! What's up with the (sin)? Do you have a reference for this preventing macro expansion? I've never heard of this. Commented Mar 16, 2009 at 14:47
  • 20
    jder, indeed the C (and C++) standard says replacement for a function like macro is done only if there is a ( immediately following the macro name. if there is a ) like in our case, no replacement is done :) 6.10.3/10 in C99 TC2 (doc n1124 here). there's an example in 7.1.4 as a footnote of this. Commented Mar 16, 2009 at 14:57
  • Neat, thanks. I also didn't know you could put parens in a function declaration. Commented Mar 16, 2009 at 15:12
  • 1
    Very nice trick. I've come across maybe one or two situations where this would be useful. Commented Mar 16, 2009 at 20:55
  • 1
    wow, I've learned something today. I was trying to understand why in boost doc they say that sometimes boost::math::isnan(z); will not compile but (boost::math::isnan)(z); will ... a pity I had to digg into your comments. I should have known that a C++ guru like you should have answered that :) I'm a fan ;) Cheers ! Commented Feb 3, 2011 at 11:15