zsh-workers
 help / color / mirror / code / Atom feed
From: ZyX <kp-pav@yandex.ru>
To: Mikael Magnusson <mikachu@gmail.com>,
	Peter Stephenson <p.stephenson@samsung.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: Fishier code in handlefeatures
Date: Tue, 06 Jan 2015 03:24:45 +0300	[thread overview]
Message-ID: <1999441420503885@web17g.yandex.ru> (raw)
In-Reply-To: <CAHYJk3RZ_1pcJEfJjUqT8P+kxrEOqBudHvdZqWoK6ZsdkP=G4A@mail.gmail.com>

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.

>
> --
> Mikael Magnusson


  reply	other threads:[~2015-01-06  0:31 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 [this message]
2015-01-06  0:32   ` Mikael Magnusson
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=1999441420503885@web17g.yandex.ru \
    --to=kp-pav@yandex.ru \
    --cc=mikachu@gmail.com \
    --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).