473,320 Members | 1,861 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,320 software developers and data experts.

Commenting during debugging, in C

Hello - I am new to this and started a new job; and for now I am in charge of debugging everyone's C code.

Can you please tell me the proper way to comment during this debugging process? Should I comment on every change I make, or just important ones? What is the programming etiquette?

thanks!
Jul 21 '08 #1
2 1265
Brosert
57
I have worked in several c/c++ roles. In each of them, every piece of code went through a formal review process on creation, and any problems were referred back to the engineer who had proposed the code change.
If a bug was found beyond this stage, it was usually reported as a known problem (which needed to be fixed with varying urgency), and the formal process would begin again to write, review and refine the code.
In addition to this, version control was used to track changes, so that it was clear who had made what change.

With more specific regard to your question, consider yourself part of the review stage. Your job is to find problems, but not necessarily fix them. If you are expected to fix them, there should be VC-ing procedures in place that can track who has modified code, and what they have modified. This being the case, my suggestion would be comment anything that isn't clear....
if you change a variable name for clarity (or spelling), this is probably evident in a check between old and new version, and may no need a comment. If you make a logic change (however small), always conside - will someone (not necessarily uyou) be able to understand what this code used to do, what this code now does and why this change was necessary.
Assuming you have license to fix problems you find without going through any Quality Control process, I would take the same (or very similar) approach to commenting areas you change as I would to commenting any other code. I have experienced projects where you are required to clearly comment all post-Release changes (or patches) eg:
Expand|Select|Wrap|Line Numbers
  1. /******* Change Request 1506 ****/
  2. int j=3; /* Changed from 4 because .... */
  3. /****** End  Change Request 1506 ****/
  4.  
Hope (some of, at least) this helps!!
Jul 23 '08 #2
gpraghuram
1,275 Expert 1GB
Its better if you comment every change you make with a proper Comment.

But dont give too much comments which may make the code cluttered.


raghu
Jul 23 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

19
by: qazmlp | last post by:
I hope comp.lang.c will not find the following question as a complete off-topic. I would like to remove ie.comment out the 'cout' statements during compilation(actually preprocessing) time. ...
4
by: pantichd | last post by:
<I also posted this on microsoft.public.vsnet.debugging 'cuz I didn't know which was more appropriate or would get quickest response> Hello, Can someone tell me how I can view the contents...
46
by: Profetas | last post by:
Hi, I know that this is off topic. but I didn't know where to post. Do you comment your source code while coding or after coding. for example: you write a procedure and after it is...
1
by: William Sullivan | last post by:
I was wondering... Are there attributes you can use to mark accessors/variables that will identify them as to be shown when hovering over an instance of the containing object during debugging? As...
1
by: Welman Jordan | last post by:
When I debug an asp.net application, which would consume a considerable amount of memory, the application throws "unhandled exception" and delivers a 500 error page to the browser. I find that...
0
by: John Rivers | last post by:
Hello, When I press F5 to start debugging an ASP.NET application it takes around 6 to 12 seconds before my code actually executes. During most of this time the CPU usage of devenv.exe hits...
8
by: lallous | last post by:
Hello I've been programming for a number of years, however my commenting style is always different. Sometimes I use something like: /************************ * method .... * comments......
1
by: Wijaya Edward | last post by:
Hi all, I have the following code: import sys import re ham_count = 0 spam_count = 0
2
by: JM | last post by:
Hi, I used to chage my code during debugging with Visual Studio 2003 (I just stopped the code using a break point and VS2003 allowed me to change the code, and continue debugging), but now with...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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: 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...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.