I once came to a complicated, multi threaded C++ program and saw:
using namespace std; // using namespace standardI'm working RIGHT NOW in a codebase where before each function definition there is a comment "// Function"
I wonder if that's intended for a specific workflow, e.g. ctrl-f "Function" enter-enter-enter-enter to cycle through all the functions in the file.
That's the only reason I can think of for writing those comments.
With a half decent IDE you do not need it. It is inexcusable.
Oh I agree, but the person who put them there must have had some sort of reason, even if it's a bad one.
> With a half decent IDE you do not need it.
I agree.
> It is inexcusable.
I think it can be quite easily excused on grounds of triviality, though whether that's appropriate may depend on context.
Re:Why Not Comments
by throwaway14356 on Wednesday September 11, 2024 @11:25PM
(#41517289)
I would write that comment if it was a long enough list of single line var assignments with enough complex ones that each have a comment like this one.
I will als name each db table column in the correct order by its correct name right above that what decided the value.
// id
user_id = getUserId();
They serve as dividers.
> Examples:
> //Add 1 to x
> x+=1;
If 3/4ths of comments are like this, maybe show a sampling of public source code (e.g. from github) that shows how prevalent comments like this are in any real codebase.
I've been programming since 1982 and have never seen this type of "add 1 to x" comment in real code, outside chapter 1 of some intro to programming book.