473,326 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Aplication to add comments to my functions

I have a projet in C++ Builder.
I want to add aome lines of comment before each function of the project.
This should work like that:

I have function:
int r(int a,char b)
{
}

this program should generate a comment before this function like that:

/**
function name - r -
parameter a -
parameter b -
returns int -
*/

or something like that.

I found CommentMakerPro, but it can't do "batch conversions" - I nedd to
select each function/method and then click to generate comments. Is there
any program to do this automatically?
Aug 28 '06 #1
3 1977
On Mon, 28 Aug 2006 21:04:14 UTC, "bim_bom" <ju******@go2.plwrote:
I have a projet in C++ Builder.
I want to add aome lines of comment before each function of the project.
This should work like that:

I have function:
int r(int a,char b)
{
}

this program should generate a comment before this function like that:

/**
function name - r -
parameter a -
parameter b -
returns int -
*/

or something like that.

I found CommentMakerPro, but it can't do "batch conversions" - I nedd to
select each function/method and then click to generate comments. Is there
any program to do this automatically?
Is there something wrong with "the human touch"? A simple copy and paste
operation will give you the prototype documentation. The important
details are the parameters, return values, and comments about the
methods. Humans are best at that.

In my opinion, most of these types of comments are useless to begin with
as they state the obvious. I'd rather see useful names and comments
about what is expected, returned, and a good description of the
operations involved.

Inline comments (those on bracket levels and where needed to explain
the code) are generally more useful than function headers.

I'd advise you to document and rework some or all of the code as you
visit each moduule or section of code. It takes a little longer at
first, but you can easily reformat and document hundreds or thousands
of lines per day. The added benefit is that you actually visited the
code and read what it is doing. You get to find problems and learn
what is in your code base.

The only true shortcut to making your code easy to use is to design
it that way. Tools may add a little fluff or reformat the code to
be easier to read, but unless you understand what it is that you
have, it is still just a mystery and you are doomed to wandering
around to find what you need or reinventing each solution as you
need it.

David
Aug 29 '06 #2
"bim_bom" <ju******@go2.plwrote in message
news:ec**********@news.onet.pl...
>I have a projet in C++ Builder.
I want to add aome lines of comment before each function of the project.
This should work like that:

I have function:
int r(int a,char b)
{
}

this program should generate a comment before this function like that:

/**
function name - r -
parameter a -
parameter b -
returns int -
*/

or something like that.

I found CommentMakerPro, but it can't do "batch conversions" - I nedd to
select each function/method and then click to generate comments. Is there
any program to do this automatically?
Why, for the sack of all that is right, would you want to do that?

int r(int a,char b)
is perfectly self documenting, as far as you want to extend it with
comments. You are giving absolutly no additional information with your
coments than the function call itself, and are taking up 6 lines of space.

This being the case, I would want to ask you why you wish to do this?
Perhaps Doxygen is what you're looking for?

That being said, it wouldn't be too difficult to write a parser to do this,
the main headache would be figuring out what is a function call and what
isn't.
Aug 29 '06 #3
bim_bom schrieb:
I have function:
int r(int a,char b)
{
}

this program should generate a comment before this function like that:

/**
function name - r -
parameter a -
parameter b -
returns int -
*/
Doxygen is the best semiautomatical documentation system I personally
know of. It runs as a standalone application and will produce a nicely
formatted HTML-documentation with relatively little effort.

Your above information would be contained in a block like (function
header is implicitly contained)
/**
@param a
@param b
@return
*/

Unless you intend to fill above "empty documentation", there's no use
in generating it at all, as doxygen can create the same html output
regardless.

If you want to fill it, modern development environments / editors
should have support for doxygen/JavaDoc/whateverDoc and produce the
above lines all by themselves. Kdevelop does, for example, with the
keyboard shortcut Ctrl Shift S.

If you are "batch-documenting" old software, just run a good
environment/editor like kdevelop, if need be on a VM. Otherwise writing
above lines manually doesn't really cost you anything, as they can be
written while thinking about the real content you want to fill in ;-)

Hope that helps, if somebody got a better way to document, I'd be
interested in knowing myself ...

Aug 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: lkrubner | last post by:
I've got a PHP application that's 2 megs in size. Of that, my guess is 200k-400k is comments. Do they impose a performance hit? I've been postponing any kind of optimization, but at some point I'll...
7
by: Marek | last post by:
Whe i'm running my .net aplication from share on other server, i've got an error. Can someone explain what i must do? Unhandle exception:System.Security.SecurityException: Permission demand type...
0
by: Szaki | last post by:
Hello I have a aplication who connect with my databases (sql server 2000). I want to do a loggin to this aplication, becouse I have constatns login in this time. I have: Dim myConnectionString...
10
by: William L. Bahn | last post by:
I'm looking for a few kinds of feedback here. First, there is a program at the end of this post that has a function kgets() that I would like any feedback on - including style. Second, for...
1
by: savvaschr | last post by:
Hello Is there a command or a way to have a vb.net aplication run in the notification area of the taskbar toolbar? I have a vb.net aplication and i want it after loading to minimize and to...
5
by: fanor | last post by:
I have a windows aplication and i would like to send email. Does anyone one know what is the yahoo server??? TIA PD: my aplication is in VS 2005 and c#.
1
by: grubbymaster | last post by:
Hello I want to add comments to functions in C++ for a better understanding of the code. I noticed this works in Visual Studio 2005 - Visual C++, but only when using Intelisense for autocomplete...
1
by: KF4fun | last post by:
Recently i am being given a windows aplication which was made using VB.net . I was asked to remake the windows aplication but i found it quite hard to do so because i am new to VB.net . The codes...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.