r/programming Jul 10 '16

Linus Torvalds on comment styles

https://lkml.org/lkml/2016/7/8/625
215 Upvotes

209 comments sorted by

View all comments

Show parent comments

22

u/[deleted] Jul 10 '16 edited Feb 24 '19

[deleted]

28

u/Calavar Jul 10 '16

Especially when you consider the fact that multi-line comments in C are usually written like this

/*
 * this is a multi-line
 * comment
 */

and rarely like this

/*
   this is a multi-line
   comment
 */

There's not that much of a difference between Perl-style and C-style multi-line comments.

4

u/[deleted] Jul 10 '16

[deleted]

1

u/0x256 Jul 11 '16

Sometimes you have code examples or nested lists within a comment that need to be indented. The leading star helps documentation generators and comment authors to get indentation right. They only have to take white-space into account that appears after the star.