3 ms·
Put the comments at the end of the line, introducing line breaks if necessary: if (…) { } else if (…) { } else { // description } and void myfunc(
by chrismorgan 9y ago
Put the comments at the end of the line, introducing line breaks if necessary:
if (…) {
} else if (…) {
} else { // description
}
and
void myfunc(int a,
char *b, // optional
...)
I don’t program in C or C++, but when working with the Windows API I appreciate Microsoft’s source-code annotation language which leads to being able to indicate input and output parameters, and optional ones, so that you’d wind up with something like this:
void myfunc(__in int a, __in_opt char *b, ...)
I don’t know how they’re implemented in MSVC, but I’m guessing they’re just empty #defines.
- wruza 9y agoSure, I’m aware of these methods; these are obvious. But my preference is to put else-comment that way, because its beauty makes me peaceful and calm when I look at it. At work I’ll do what PM expects, i.e. her/his [motivated] preferences, not mine (if you ask people what they’d like to do, work will be hardly a popular option at all, so no problem, it is consensus between being “busy” and having profit).