From: Sergey Organov <sorganov@gmail.com>
To: Akib Azmain Turja <akib@disroot.org>
Cc: Eli Zaretskii <eliz@gnu.org>, Phil Sainty <psainty@orcon.net.nz>,
emacs-devel@gnu.org
Subject: Re: [C source] Inconsistent comments on preprocessor conditionals
Date: Fri, 08 Jul 2022 19:28:44 +0300 [thread overview]
Message-ID: <87zghj7emb.fsf@osv.gnss.ru> (raw)
In-Reply-To: <875yk73e12.fsf@disroot.org> (Akib Azmain Turja's message of "Fri, 08 Jul 2022 19:55:05 +0600")
Akib Azmain Turja <akib@disroot.org> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> Date: Sat, 09 Jul 2022 01:33:26 +1200
>>> From: Phil Sainty <psainty@orcon.net.nz>
>>> Cc: Akib Azmain Turja <akib@disroot.org>, emacs-devel@gnu.org
>>>
>>> On 2022-07-09 00:55, Eli Zaretskii wrote:
>>> > You mean, the comment for the #endif line? It doesn't really matter
>>> > how you comment that, because both comments tell the same: the
>>> > #ifdef'ed conditional block ends here. The differences in this case
>>> > are purely stylistic.
>>>
>>> The "#endif /* not FOO */" version provides the extra information that
>>> there *is* an "#else" clause
>>
>> No, it doesn't, because the conditional could start with #ifndef
>> instead.
>
> Then we can do like the following:
>
> #ifndef FOO
> ...
> #else /* not !FOO */
> ...
> #endif /* not !FOO */
It should then rather be something like:
#ifndef FOO
#else /* not ndef FOO */
#endif /* not ndef FOO */
as there also could be:
#if !FOO
#else /* not !FOO */
#endif /* not !FOO */
From that POV, the original should better be:
#ifdef FOO
#else /* not def FOO */
#endif /* not def FOO */
to tell it from:
#if FOO
#else /* not FOO */
#endif /* not FOO */
Just for mentioning, for myself I've adopted shorter style:
#ifdef FOO
#else /*! def FOO */
#endif /*! def FOO */
where "/*!" reads like a specific single token clearly separate from the
#if condition, thus avoiding confusion.
--
Sergey Organov
next prev parent reply other threads:[~2022-07-08 16:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 12:47 [C source] Inconsistent comments on preprocessor conditionals Akib Azmain Turja
2022-07-08 12:55 ` Eli Zaretskii
2022-07-08 13:33 ` Phil Sainty
2022-07-08 13:37 ` Eli Zaretskii
2022-07-08 13:55 ` Akib Azmain Turja
2022-07-08 14:01 ` Eli Zaretskii
2022-07-08 14:21 ` Phil Sainty
2022-07-08 16:28 ` Sergey Organov [this message]
2022-07-08 19:54 ` Stefan Monnier
2022-07-11 12:42 ` Akib Azmain Turja
2022-07-08 12:57 ` Po Lu
2022-07-08 13:47 ` Alan Mackenzie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zghj7emb.fsf@osv.gnss.ru \
--to=sorganov@gmail.com \
--cc=akib@disroot.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=psainty@orcon.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).