On Thu, 6 Nov 2014 10:28:51 -0500 Bobby Powers <bobbypow...@gmail.com> wrote:
> I personally find C++ style comments more pleasant on the eyes for > single-line comments, and they are part of the C99 spec. De gustibus non est disputandum. I personally prefer {/*, */}. > Can someone explain why they think /* */ sucks less than // ? It > doesn't seem like it is for compatibility when st and dwm require C99 > anyway. An internet search did not turn up much, apologies if I've > missed an obvious link or previous discussion. There are many ways to show why {/*, */} sucks less than {//}. Here is one: If you take a look at C, everything is block-oriented. The smallest linguistic entity is "...;", followed by "(...)" and "{...}". The traditional comments "/*...*/" are part of this axiomatic system. This approach is not line-oriented. Taking preprocessor directives and includes aside, you can literally strip all newlines from a given C-source and it would still compile. It's okay that preprocessor directives and includes are an exception here, given they are normally used before the first function definition. C++-style comments don't follow the block orientation. They break it. Stripping all newlines from a C-source with {//} as a linguistic subset will break the program. Given we at suckless work according to the UNIX-philosophy, and even though UNIX-streams are mostly line-oriented, a C-source should not depend on non-printable characters to function properly (except for includes and preprocessor directives). Moreover, if you write multiline-comments and use {/*, */} while at the same time using {//} for one-liners can really disrupt code consistency, and in the end make code harder to maintain and augment. Because of these reasons, it makes sense to forbid C++-style comments in a general coding convention. Cheers FRIGN -- FRIGN <d...@frign.de>