[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [C source] Inconsistent comments on preprocessor conditionals
From: |
Akib Azmain Turja |
Subject: |
Re: [C source] Inconsistent comments on preprocessor conditionals |
Date: |
Mon, 11 Jul 2022 18:42:04 +0600 |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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.
>
>
> Stefan
>
Yes, comments are actually hints, and they can get out of sync. But I
usually study programs relatively much new, which is written once and
the working parts are never touched again. Comments there are usually
up to date. But for the almost half a century old source code of Emacs,
this is not true.
--
Akib Azmain Turja
This message is signed by me with my GnuPG key. It's fingerprint is:
7001 8CE5 819F 17A3 BBA6 66AF E74F 0EFA 922A E7F5
signature.asc
Description: PGP signature
- [C source] Inconsistent comments on preprocessor conditionals, Akib Azmain Turja, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Eli Zaretskii, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Phil Sainty, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Eli Zaretskii, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Akib Azmain Turja, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Eli Zaretskii, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Phil Sainty, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Sergey Organov, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals, Stefan Monnier, 2022/07/08
- Re: [C source] Inconsistent comments on preprocessor conditionals,
Akib Azmain Turja <=
Re: [C source] Inconsistent comments on preprocessor conditionals, Po Lu, 2022/07/08
Re: [C source] Inconsistent comments on preprocessor conditionals, Alan Mackenzie, 2022/07/08