-1

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.

8
  • 1
    what do they allow? Commented Jan 20, 2014 at 5:51
  • Microsoft apparently allows non-standard, single-line comments in C89 projects. I feel like a rebel taking advantage of it. Commented Jan 20, 2014 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. Commented Jan 20, 2014 at 6:12
  • 3
    @Phil, AFAIK C99 had just standardized what was already a common extension at the time. Commented Jan 20, 2014 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. Commented Jan 28, 2014 at 17:31

1 Answer 1

6

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.