From: Mikael Magnusson <mikachu@gmail.com>
To: ZyX <kp-pav@yandex.ru>
Cc: Peter Stephenson <p.stephenson@samsung.com>,
zsh workers <zsh-workers@zsh.org>
Subject: Re: Fishier code in handlefeatures
Date: Tue, 6 Jan 2015 01:32:38 +0100 [thread overview]
Message-ID: <CAHYJk3QP+mPCGpjia6aB+UxwGa9ePVceK7v4RBu-aMC5epYLRw@mail.gmail.com> (raw)
In-Reply-To: <1999441420503885@web17g.yandex.ru>
On Tue, Jan 6, 2015 at 1:24 AM, ZyX <kp-pav@yandex.ru> wrote:
> 06.01.2015, 03:21, "Mikael Magnusson" <mikachu@gmail.com>:
>> mod_export int
>> handlefeatures(Module m, Features f, int **enables)
>> {
>> if (!enables || *enables)
>> return setfeatureenables(m, f, *enables);
>> *enables = getfeatureenables(m, f);
>> return 0;
>> }
>>
>> so if enables is NULL, we immediately do *enables? I'm not sure what's
>> intended here but obviously it somehow works.
>
> NULL is false, so if enables is NULL !enables is true and *enables is not evaluated due to short-circuiting. Nothing wrong here.
Read the next line too.
--
Mikael Magnusson
next prev parent reply other threads:[~2015-01-06 0:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 0:20 Mikael Magnusson
2015-01-06 0:24 ` ZyX
2015-01-06 0:32 ` Mikael Magnusson [this message]
2015-01-06 0:36 ` ZyX
2015-01-06 7:45 ` Bart Schaefer
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAHYJk3QP+mPCGpjia6aB+UxwGa9ePVceK7v4RBu-aMC5epYLRw@mail.gmail.com \
--to=mikachu@gmail.com \
--cc=kp-pav@yandex.ru \
--cc=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/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.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).