Hacker News new | ask | show | jobs
by nikai 4035 days ago
Not even in C. You can have an if condition that is actually a macro that expands with parentheses. For example the macros in ctype.h, so you can actually write

  if islower(c) {
      (..)
  }
3 comments

That's not portable, though: A comforming implementation may very well implement islower as a function call, and you should treat is as such.
Yeah, but macros are not really part of the language, they're more a writing aid than anything really.

So, for the sake of good practices, write if with parenthesis.

That is cheating!