I noticed Visual C++ 2010 (my current environment) and XCode both allow non-standard single-line comments in my C programs. Since these are both my target platforms, I assume it's fine to use it? VC++ 2010 doesn't support C99, so I'm limited to C89, though I know C99 added support.

closed as primarily opinion-based by user53019, Kilian Foth, thorsten müller, Robert Harvey, Dynamic Jan 28 '14 at 21:24

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    what do they allow? – John Dvorak Jan 20 '14 at 5:51
  • Microsoft apparently allows non-standard, single-line comments in C89 projects. I feel like a rebel taking advantage of it. – Phil Jan 20 '14 at 6:02
  • 1
    For C99/C++, yes. But no, in that C89 only has multi-line comments. MS adds single-line comments to use in C89 projects, which is.. quite interesting and rebelling. – Phil Jan 20 '14 at 6:12
  • 3
    @Phil, AFAIK C99 had just standardized what was already a common extension at the time. – AProgrammer Jan 20 '14 at 8:14
  • 2
    Given that it would not be that hard to write a tool to convert single line comments into “standard” comments, the risk is low. – Ian Jan 28 '14 at 17:31

Anything that works is fine as long as you don't care about the environments where it doesn't work. If you have no ambitions to compile your code in an environment that doesn't support one-line comments (presumably comments that begin with // and continue to the end of the line), then it's fine.

Not the answer you're looking for? Browse other questions tagged or ask your own question.