Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd prefer to use C-style comments in C++ sources:

class Dog {
    string name;                /* The dog's name */
    ...
    void bark();                /* Print messages in Dog's
                                   language */
}

However, in cc-mode, when I enter ALT+;, I can only get C++-style comments:

class Dog {
    string name;                // The dog's name
    ...
    void bark();                // Print messages in Dog's
                                // language
}

Can I set the default comment style in cc-mode to C-style?

share|improve this question
up vote 1 down vote accepted

One way is to set the comment-start and comment-end variables as follows:

(add-hook 'c++-mode-hook
          (lambda () (setq comment-start "/* " comment-end " */")))
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .