Thread: Comment using // or /* &&& */

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    175

    Comment using // or /* &&& */

    Hello All,

    As per I know, C support two types of code commenting techniques.

    Block comment
    /* */

    and line comment
    //

    I heard that while developing the code and if we want to comment, it is better to use block comment instead of line comment as line comments are not supported by some compiler.

    Is this true?

    Please let me know....

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    // comments are from C++, and lately, from C99. Therefore, if your compiler doesn't support the C99 standard, you should use /* */. If you have a newer C99 compatible compiler, you're allowed to use the newer style.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    4
    Quzah:
    Ever see this issue with gcc?

  4. #4
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >Ever see this issue with gcc?

    Enforce the old standard and you can see it yourself: -std=c89.
    Last edited by Dave_Sinkula; 03-16-2005 at 02:58 PM. Reason: Added link.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can someone clarify this comment.
    By Overworked_PhD in forum C Programming
    Replies: 2
    Last Post: 05-15-2007, 10:17 PM
  2. Tab->Space converter and comment colorizer
    By Kleid-0 in forum A Brief History of Cprogramming.com
    Replies: 8
    Last Post: 01-30-2005, 05:46 PM
  3. Can someone help me understand this example program
    By Guti14 in forum C Programming
    Replies: 6
    Last Post: 09-06-2004, 12:19 PM
  4. what is a pragma comment?
    By Shadow12345 in forum C++ Programming
    Replies: 9
    Last Post: 11-25-2002, 05:50 AM
  5. comment on C++ books, please
    By ustuzou in forum C++ Programming
    Replies: 9
    Last Post: 02-18-2002, 12:19 PM