Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6715893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:40:06+00:00 2026-05-26T08:40:06+00:00

Most languages I’ve worked with don’t have support for recursive comments. Is there any

  • 0

Most languages I’ve worked with don’t have support for recursive comments.

  1. Is there any reason why language designers would choose not to implement this?
  2. Is it deceptively complex?
  3. Would it have undesired results?

Example of a recursive comment:

/*
for (int j = 0; j <= SourceTexture.Height; j += SampleSize)
{
    ...
}

// Comment within comment below:
/*for (int i = 0; i < TextureColour.Length; i++)
{
    ...
}*/


sourceTexture.SetData<Color>(TextureColour);
*/

EDIT: I understand the argument of the answers so far (problems occur when you have comment tokens in strings). However, the reason for my confusion is that you have that problem now.

For example, i know the code below wouldn’t give the expected result.

/*
    char *str = "/* string";
    // Are we now 1 level inside a comment or 2 levels?

*/

printf("Hello world");

/*
    char *str2 = "string */";
*/

But in my mind that’s no different to an unexpected result in the case below:

/*
CODE "*/";
*/

Which would also yield an unexpected/undesired result.

So, while it could be a problem for recursive comments, my argument as to why that’s not a reason not to do it, is that it is already a problem for non-recursive comments. As a programmer i know the compiler behaves like this and i work around it. I don’t think it’s much more effort to work around the same problem with recursive comments.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:40:07+00:00Added an answer on May 26, 2026 at 8:40 am

    Is there any reason why language designers would choose not to
    implement this?

    It makes the lexical analysis more difficult to implement.

    Is it deceptively complex?

    IMHO, no, but this is subjective.

    Would it have undesired results?

    Hard to tell. You have already discovered that even normal block comments can make problems:

    /* print ("*/");    */
    

    I know 2 languages that have nesting block comments: Haskell and Frege.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I realize most languages support multiple languages, but every language I've seen has always
I haven't heard of any, most languages seem to just have division of ints
Most languages have some sort of date function where you really don't have to
How do I make multi-line comments? Most languages have block comment symbols like: /*
Of course most languages have library functions for this, but suppose I want to
I have read that most languages are becoming more and more like lisp, adopting
Most program languages have some kind of exception handling; some languages have return codes,
Do most languages have many different execution engines ?
I have the following VB.NET code (but for each loops are in most languages,
I'm coding in Java, but most languages would do just fine. Right now, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.