79797076

Date: 2025-10-22 17:17:25
Score: 2
Natty:
Report link

Ah! What you’re seeing isn’t actually C++ behavior—it’s coming from whatever editor or IDE you’re using. Let me break it down carefully:

  1. C++ block comments:

    • Correct: /* this is a block comment */

    • Starts with /* and ends with */. Everything in between is ignored by the compiler.

  2. Your typo: /**

    • In plain C++, this is still just a block comment, because the compiler only cares that it starts with /* and ends with */. The extra * doesn’t change compilation.

    • So for the compiler, /** something */ is perfectly valid.

  3. Why your editor shows bold:

    • Many editors (VS Code, JetBrains IDEs, etc.) use syntax highlighting rules that interpret /** as the start of a documentation comment (like Doxygen in C++).

    • Documentation comments are meant to describe functions, classes, or variables, and IDEs often render them in bold, italic, or a different color to distinguish them from regular comments.

    • Example:

      /**
      * This is a doc comment
      */
      void foo() {}
      
      

      Here, /** triggers the editor to treat it as a doc comment.

In short: Your code is fine for compilation; the bold just means your editor thinks it’s a doc comment (Doxygen-style).

If you want, I can also show a quick table of all C++ comment types and how editors usually highlight them so you can avoid these visual surprises. Do you want me to do that?

Reasons:
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: ChatGPT Bot