What's a good way to do the plural when writing comments?

When writing comments, sometimes I have to talk about the type (class, structure, etc.) in the plural when writing comments, for example:

/* * getThings * Get a list of --> Things <-- from somewhere. */ Thing *getThings(void); 

The problem is that the type name is singular (namely, Thing ), but I want to talk about them in the plural in the comments.

If I say Things , this tells the reader that he is talking about the type of Things , which is not so. If I say Thing's , it looks uncomfortable because it is not grammatically correct (it is either possessive or "Thing", not the plural). I could discuss the problem and say a list of Thing items

What good convention to follow when writing multiple types?

+7
comments
source share
2 answers

Well, depending on the documentation system you use, you can wrap the type name in special syntax and put it outside of it. For example:

.NET XML Comments

 Get a list of <see cref="Thing"/>s from somewhere. 

doxygen C / C ++ comments

 Get a list of \link Thing \endlink s from somewhere. 

Not defined 100% according to the doxygen variant, but it should be something like this.

And if you are not using a specific documentation system and therefore have no special comments, I would do something like:

 Get a list of [Thing]s from somewhere. 

Or you can use () or {}, depending on your preference ...

+2
source share

I would use "s" in parentheses.

 /* Get a list of Thing(s) from somewhere */ 
+1
source share

All Articles