what is the most effortless way to add a description comment to a function

B

bluekite2000

Currently, whenever I write a new function, I have to copy and paste
/******************************************************************
* description of function
******************************************************************/
void foo ()
{
}

Is there a way to automatically generating the stars making up the
comment box? If its of any help, i use emacs.
 
V

Victor Bazarov

Currently, whenever I write a new function, I have to copy and paste
/******************************************************************
* description of function

You mean, _literally_ those words? What's the point?
******************************************************************/
void foo ()
{
}

Is there a way to automatically generating the stars making up the
comment box?

I bet there is. Right next to that button that automatically generates
the function for you... Oh, did you mean you don't actually generate the
function automatically? Well, if you have to type the function, you must
realise that typing (or copy-pasting) the comment is essentially the only
way to go.
> If its of any help, i use emacs.

Oh, of course it is of help. Go to the emacs newsgroup to ask about it.
You can probably write a script and tie it to a key somehow...

In C++ comments do not really serve any need, they are removed from the
code on very early stages of compilation, so the language does not have
any means to _create_ comments. BTW, if you haven't noticed, this is
a _language_ newsgroup.

V
 
R

red floyd

Currently, whenever I write a new function, I have to copy and paste
/******************************************************************
* description of function
******************************************************************/
void foo ()
{
}

Is there a way to automatically generating the stars making up the
comment box? If its of any help, i use emacs.
Try asking in an emacs newsgroup.
 
W

wee

I've seen automatic comment generation when you use IDEs such as Visual
Studio.

Otherwise, you could write a program that will read in your code
classes, find where each function starts, and add a description segment
above it (which you would then have to fill in for each specific
method). You could write this in Perl or Python, for instance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top