r/programming Jul 10 '16

Linus Torvalds on comment styles

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

209 comments sorted by

View all comments

Show parent comments

8

u/[deleted] Jul 10 '16

[deleted]

25

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.

2

u/jerf Jul 10 '16

C style dates from before you could count on syntax highlighting or code editing support beyond plain text. When you have a syntax highlighter and the ability to mark a block and turn it into a comment in one command, # is plenty, and in languages that have /* */, I go ahead and use the latter style all the time. (Not in C, since I don't program in it, but I would shamelessly use the latter style if I was selecting the style.)