Skip to content
This repository was archived by the owner on Oct 9, 2018. It is now read-only.

recommendation to use only line comments not justified #37

Open
brson opened this issue Dec 4, 2014 · 2 comments
Open

recommendation to use only line comments not justified #37

brson opened this issue Dec 4, 2014 · 2 comments

Comments

@brson
Copy link
Contributor

brson commented Dec 4, 2014

It just says to use line comments but not why.

@nathantypanski
Copy link
Contributor

The justification, IMO, is that:

  • Line comments are easy to spot compared to block comments (barring syntax highlighting, but we shouldn't assume everyone has perfect syntax highlighting always - especially in, e.g., a code diff).
  • Line comments make it easier to keep consistent indentation. This is especially relevant in Markdown documentation, which is indentation-aware.

Though I think the choice is mostly arbitrary; we're forced to "pick one and make it a convention;" the Google C++ Style Guide remarks that:

Use either the // or /* */ syntax, as long as you are consistent.

You can use either the // or the /* */ syntax; however, // is much more common. Be consistent with how you comment and what style you use where.

The argument that "// is much more common in Rust" (much like above) is IMO the best argument in its favor, however. When it comes to code style, "my way is popular" is the most important justification you could have.

@aturon
Copy link
Member

aturon commented Dec 5, 2014

The pure style (non-API) part of the guidelines need a complete overhaul and RFC laying out the rationale, IMO. But no one has had the time to do this yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants