comments

Do comments affect Perl performance?

I'm optimizing some frequently run Perl code (once per day per file). Do comments slow Perl scripts down? My experiments lean towards no: use Benchmark; timethese(20000000, { 'comments' => '$b=1; # comment ... (100 times) ', 'nocomments' => '$b=1;'}); Gives pretty much identical values (apart from noise). Benchmark: timing 1...

gcc compiler: How do I enable C++ styled comments while leaving ANSI enabled

This has just come up as a question where I worked so I did a little digging and the answer is a ExpertsExchange one. So I hand you over to the original question asker, Manchung: I have a project written in pure C which is to be used in embedded system. So, I use pure C to minimize the code size. When I compile the project, I us...

Commenting code that is removed?

Is it a good practice to comment code that is removed? For example: // Code to do {task} was removed by Ajahn on 10/10/08 because {reason}. Someone in my developer group during a peer review made a note that we should comment the lines of code to be removed. I thought this was a terrible suggestion, since it clutters the code with us...

Commenting out comments

I've noticed, using visual studio 2003, that I can "comment out" my comments to make them no longer be comments. This one needs an example: If I have: /* int commented_out = 0; */ I can comment out the /* and */ with // and code within the /* and */ is no longer "commented out" (the text changes to non-comment color and the compiler ...

"Holds value of property" in Java code

I got some legacy code with that caption spread out as comment almost in every field. Also appearing is "Setter for property xyz". Just out of curiosity, which Java tool generated this stubs? ...

C# comments tutorial

I would like to know which one is the best material that I can hand out to my students about "C# comments". ...

Copying Xml comments for implemented intefaces

When you use a tool like Resharper to implement an interface, you can choose to copy the Xml documentation markup. Of course there are times when the comments are going to be different for the concrete classes - but in the cases where they are identical, we now have a clear violation of don't repeat yourself. Is this an unavoidable viola...

Do you have examples of comments or todos that were difficult to interpret?

I'm writing a chapter of my dissertation that deals with contextual cues and I'm looking for good examples of comments (or todo comments) where it's obvious that whoever wrote them had some knowledge that he didn't bother sharing with future readers, making them difficult to interpret. Examples from publicly available code would be esp...

Best practices for version control comments

There is a lot of conversation about commenting code, but how about commenting on check-ins? I found this blog post: http://www.redbitbluebit.com/post/Subversion-Check-In-Comment---Great-Practices.aspx As the guy who is putting together the release notes, I am looking for ways to make that job easier. Currently we defined our own sche...

How do you flag code so that you can come back later and work on it?

In C# I use the #warning and #error directives. #warning This is dirty code... #error Fix this before everything explodes! This way the compiler will let me know that I still have work to do. What technique do you use to mark code so you won't forget about it? ...

Delphi Short Cut to add Date and Name Comment

Does anyone know of a short cut to place my name and the date where the cursor is i.e. //021208 DarkAxi0m so i don't keep check what the date is when i'm adding comments. Im using Delphi7, with CnPack And GExperts Installed. I think it should be able to be done with one of those experts. ...

Hide Comments in Code in Unix Environment

I work in a Unix environment with the typical Unix tools (emacs, vim, gvim, sunstudio, etc) My project has huge gross boilerplate comments on every method. It makes the files thousands of lines long, with a couple hundred lines of actual code. I may be exagerrating a bit but you get the idea. I am looking for a way when viewing these fi...

Modifying existing code, what's your commenting style?

When you modify existing code, how do you comment the code? i.e. // changed code to ... // by: blankman // modified: 20081204 Looking for a nice format ... ...

Where to put the doxygen comment blocks for an internal library - in H or in CPP files?

The common sense tells that the Doxygen comment blocks have to be put in the header files where the classes, structs, enums, functions, declarations are. I agree that this is a sound argument for a libraries that are mean to be distributed without its source (only headers and libs with object code). BUT...I've been thinking of the exact...

Can you create a "Comments" section in a SharePoint wiki?

I'm trying to create a Comments section in my wiki. There's one solution on the Web involving the creation of a "column," but that seemed to just create a second text block under the main article block. This is impractical, because subsequent edits don't create new comments - they seem to just edit the existing comment. There are a fe...

Marking-up argument names in comments of functions

Hello, One of the most common dilemmas I have when commenting code is how to mark-up argument names. I'll explain what I mean: def foo(vector, widht, n=0): """ Transmogrify vector to fit into width. No more than n elements will be transmogrified at a time """ Now, my problem with this is that the argument names vector, wid...

Adding the same comment to every code file in a Visual Studio solution

Background: We are using VS 2008 and are in the process of upgrading from TFS 2005 to 2008. We have a solution that contains several projects and overall have hundreds of code files. We want to add the same text as a comment to all of these files (a copyright message). Does anyone know of a quick/easy/efficient way to do this? Also, ...

Are comments necessary for a programming language?

After some stupid musings about Klingon languages, that came from this post I began a silly hobby project creating a Klingon programming language that compiles to Lua byte-code. During the initial language design phase I looked up information about Klingon programmers, and found out about this Klingon programming rule: A TRUE Klingon...

Ideas on implementing Stack Overflow-style comments

I like the Stack Overflow comment UI a great deal and I'm looking into implementing the same thing on my own website. I looked at the code and it looks like the main tool here is WMD, with the JQuery TextArea Resizer playing a supporting role. WMD converts Markdown into HTML on the client side. That's pretty nice because it helps out w...

Strip Comments from XML

I've encountered the need to remove comments of the form: <!-- Foo Bar --> I'd like to use a regular expression that matches anything (including line breaks) between the beginning and end 'delimiters.' What would a good regex be for this task? ...