[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [C source] Inconsistent comments on preprocessor conditionals

From: Stefan Monnier
Subject: Re: [C source] Inconsistent comments on preprocessor conditionals
Date: Fri, 08 Jul 2022 15:54:33 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

> The "#endif /* not FOO */" version provides the extra information that
> there *is* an "#else" clause -- which might be helpful if the clauses
> are spaced very far apart.  If "#endif /* FOO */" is then consistently
> used only for cases with no "#else", some code may be (very) slightly
> easier for people to parse.

FWIW, I personally never trust whether the comment is positive or
negative; instead the comment only tells me that it's the else/endif
that matches the condition that has to do with FOO (as opposed to some
other `#if` that tests something different), so the presence/absence of
`not` doesn't make much difference for me.  Maybe it's because of a lack
of a clear and religiously followed convention.

Also, those comments tend to get out of sync with the code, of course.

IOW, I'd rather not have those comments and let Emacs generate that info
dynamically, so it's always up-to-date and reliable.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]