metamath / metamath-exe

Metamath program - source code for the Metamath executable
GNU General Public License v2.0
77 stars 25 forks source link

consistent comment after #endif directives (in files mmfatl.*) #118

Closed benjub closed 1 year ago

benjub commented 1 year ago

I tried to make comments after #endif more consistent by systematically recalling the identifier that was after the mathching #if(n)def directive. Please @wlammen tell me if this is correct and if I can do that for the other files.

What about removing double blank lines everywhere ? (regex \n\n\n)

wlammen commented 1 year ago

It is grammatically correct, and can be used to increase readability when the framing #if and #else #endif are more than a few lines apart, or are heavily nested, so you might get the corresponding pair wrong. Maybe it is used for automatic code maintenance using simple scripts, too. Otherwise the extra comments can have a bit of a littering effect, imo. So the particular examples here are questionable. Would they have helped you grasp the code logic easier?

benjub commented 1 year ago

I think everything that tends to more consistency makes it easier. I am new to the C language and I tried to have a look, but I'm daunted by the size of the code base... Is it possible to run some kind of autoformatting tool to ensure consistency of indentations, linebreaks, etc. ?

wlammen commented 1 year ago

Some C/C++ IDE like eclipse https://www.eclipse.org/downloads/packages/release/2022-12/r/eclipse-ide-cc-developers come with some kind of formatting support.

digama0 commented 1 year ago

I think everything that tends to more consistency makes it easier.

Strong agree with this. We should strive for consistency in the codebase, even if the style is a bit weird - nothing is worse than a codebase with inconsistent and weird style. (If the style is bad, I also welcome changes to improve it, provided they are applied uniformly.)

digama0 commented 1 year ago

What about removing double blank lines everywhere ? (regex \n\n\n)

Sounds good to me.