comments

How to make comments on if statements most readable

I'm trying to make my code easily understood by future readers. I've always had issues with how to word my if statement comments to make it the most understandable. Maybe it seems trivial, but it's something that's always bothered me Here's an example: if ( !$request ) { $request = $_SERVER['REQUEST_URI']; } Here are some way I...

Are there a Code Conventions for Assembly (mainly PIC)?

Are there a Code Conventions for Assembly (mainly PIC)? ...

Vim: Insert Comments automatically

From here: Vim Comment HOWTO I've been able to type the :set comments=sl:/*,mb:*,elx:*/ command. Because my sas code requires this style comments: /* * This is the comment */ The problem is once I type this set command I don't know how to actually get those comments to add to the code... the instructions say to type "...

How to strip out robo-comments and #region from C#?

I've got some code I'm maintaining that has a good deal of machine generated comments and machine generated regions. (or created by a particularly misled developer) These are comments exclusively repeating the method metadata and space expansions of pascal cased names: #region methods /// <summary> /// Implementation of a public met...

Javascript XML Comment Documentation

I'm building a custom library of composite controls that include their own javascript files as web resources. I've got DocProject running to generate my XML documentation CHMs and it's working great. However, when I set my solution to "Release" configuration, the runtime is still not extracting the XML comments from the embedded javasc...

How do you check in code with different comments on different classes?

What do you think is the best practice for checking in code from multiple files that implement multiple changes, but are ready to go in at one time? Do you check them all in at once, keeping the checking reasonably atomic, and put the changes in one long comment? Do you check in the files in groups so the right comment is associated wi...

What is the preferred way of notating methods in comments?

Hey! Sometimes one has to refer to another method when commenting. Here some example in PHP: class A { /** * @see B::bar */ public function foo() { B::bar(); } } class B { public static function bar() { // ... } } So what if there would be a non-static method bar in class B? What...

When To Comment Code (The Other "When")

Yesterday I was going through some code of mine which made no sense to me at first (written less than a month ago). When I understood it, I quickly added comments to avoid the exercise. This made me think that, had I commented on the code as I wrote it, my comments might not have helped a later "me" decipher the code. When in the code'...

Do you update ancient code comments that are wrong?

G'day, Inspired by a comment I made in my answer to this question on commenting Perl regexps I was wondering the following. When you are working on older, old, bloody ancient, code do you update comments that are out of sync with the code or do you just update the code and ignore the comments that are already "miles out" from the reali...

Function/Class Comment Formatting Conventions

Who has the most readable and useful function/class commenting convention? I'm not looking for something that generates docs, but I'm considering adopting something like JavaDoc because all the info is there. /** * This function processes data * * @param p1 the first piece of data * @param p2 the second piece of data * @return t...

Modified preorder traversal for comment system

Hi, I'm trying to make a comments system for a blog. I have the modified preorder traversal system working (used this guide: http://dev.mysql.com/tech-resources/articles/hierarchical-data.html). I have a few issues though. I do not think that guide explains how to manage having different blog posts, and adding a comment that is not a re...

How to reference specific implementations of generic interfaces in XML comments?

Hi all.. Consider this scenario, 2 interfaces, 1 generic: public IGenericAdder<T> { T Add(T, T); } public IIntAdder : IGenericAdder<Int32> { } Is there someway that I can do XML comments on the generic add method, so that intellisense will show "Adds the Int32" if I do a: IIntAdder foo; foo.Add( //Show intellisense here ...

Commenting Conventions

I want to know what are some guidelines for commenting? I am coding in Java for class. I want to have readable code. In another question I was told "how" comments should be reserved for difficult sections of code. I was told that my code comments added no knew information. Comments are not only for readers. They are also reminders to the...

Xml Comments Localization

Hello there, I'm going to use XML comments to document an extensibility API of an application, but I didn't find any reference to use multiple languages or any way to localize these files. I would like to use sandcastle or any other tool (ABD...?), but I don't know where to put the translated XML comments, I don't know if I should use t...

Intellisense tip and XML returns comment (VS2008)

I've found tooltips displayed by Intellisense when keying method name as very usefull but I can see only summary and params info - no returns comments Eg - I can not see below comment: <returns> Enriched object</returns> Is it a way to make it visible? EDIT Maybe you know the tool replacing standard Intellisense and displaying r...

cryptic comment in jdk source: // HD, Section 2-1

i just stumbled onto this comment. public static int lowestOneBit(int i) { // HD, Section 2-1 return i & -i; } in the 1.5 java source. what does this comment mean? is it a reference to a book? a spec? ...

Stripping HTML Comments With PHP But Leaving Conditionals

I'm currently using PHP and a regular expression to strip out all HTML comments from a page. The script works well... a little too well. It strips out all comments including my conditional comments in the . Here's what I've got: <?php function callback($buffer) { return preg_replace('/<!--(.|\s)*?-->/', '', $buffer); } ...

Commenting code in Notepad++

Hi I'm using Notepad++ as an editor to write programs in Python. It might sound daft but I looked around in the editor and could not find any means (not the manual way but something like in Emacs) to do a block comment in my code. Since so many language settings are supported in Notepad++, I'm curious to find a way to block comment cod...

Make Eclipse formatter ignore comments?

Is there a way to make Eclipse's built-in formatter ignore comments? Whenever I run it, it turns this: /* * PSEUDOCODE * Read in user's string/paragraph * * Three cases are possible * Case 1: foobar * do case 1 things * Case 2: fred hacker * do case 2 things * Case 3: co...

Django Paginated Comments .. is there any existing solutions?

Hi, is there any existing pagination solution for Django contrib.comments? What I need is just a simple paginated django comments, for the Basic Blog application (from the Django Basic Apps) I used, using a simple has_previous and has_next I have copied the django.contrib.comments and tried modify the code but with no success. The code...