Share
Explore BrainMass

Comments in Programming Languages

Many contemporary languages allow two kinds of comments, one in which delimiters are used on both ends(for multiple-line comments), and one in which delimiter marks only the beginning of the comment ( for one-line comments), Discuss the advantages and disadvantages of each.

Solution Preview

Comments are intended for human readers and are ignored by the compiler. They do NOT make the executable code longer, nor do they cause the program to slow down.

Programs typically contain a mixture of both comment forms. Comment pairs generally are used for multi-line explanations, whereas double slash comments tend to be used for half-line and single-line remarks.

*Both-End Comment Disadvantage: Comment Pairs Do Not Nest
A comment that begins with /* always ends ...

Solution Summary

There are two kinds of comments allowed in programming languages - one in which delimiters are used on both ends(for multiple-line comments), and one in which delimiter marks only the beginning of the comment ( for one-line comments). The advantages and disadvantages of each of them are discussed.

$2.19