Re: [dev] c++-style comments [was fsbm]
There is one case where C++ style comment create a useful feature that I
don't believe C style comments are able to replicate. Some might disagree.
In a color syntax highlighting editor in a C99 codebase, you can prefix C
style comments with C++ style comments and get single character feature
enable/disabling.
//* Remove first / to disable this block
doSomething();
//*/
In a color syntax highlighting editor, doSomething(); takes on normal
highlighting when enabled, and takes on comment colored highlighting when
disabled. Visually, that's slightly improved over something like
#ifdef DEBUG
doSomething();
#endif
where you need to know what defines are created in your codebase, and maybe
there is a clash with a header or deep in the header chain, and you need to
know what defines are created on the command line.
On Thu, Nov 6, 2014 at 8:37 AM, Dimitris Papastamos <sin_AT_2f30.org> wrote:
> On Thu, Nov 06, 2014 at 10:28:51AM -0500, Bobby Powers wrote:
>> 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.
>
> For consistency with multiline comments and for allowing the code
> to compile with C89.
>
> Also // looks terrible.
>
> And no, the fact that /* */ cannot be nested is not an argument in
> favor of //.
>
Received on Thu Nov 06 2014 - 18:34:17 CET
This archive was generated by hypermail 2.3.0
: Thu Nov 06 2014 - 18:36:08 CET