Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Fishier code in handlefeatures
- X-seq: zsh-workers 34099
- From: ZyX <kp-pav@xxxxxxxxx>
- To: Mikael Magnusson <mikachu@xxxxxxxxx>, Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- Subject: Re: Fishier code in handlefeatures
- Date: Tue, 06 Jan 2015 03:24:45 +0300
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1420503885; bh=l4m00LPir+sEX/MlGrWgNdETkXhKwEWEicsnKaREEfs=; h=From:To:Cc:In-Reply-To:References:Subject:Date; b=AqV+TuMLYgcPofHGJrklA+BY/Nu4vmLFliXTJKwYP3OaNn99MNCg74Ucw3ucjRSj7 DxHNrMQWfAfWg+zlarrBdyEodz9ha7eCGxZTrS2VKbMGVCVM7WCrpadeZzrCMuCegS bobXVjOn0/3wUnl0AeKJ7uTW8DxJFhXpSubpyc68=
- In-reply-to: <CAHYJk3RZ_1pcJEfJjUqT8P+kxrEOqBudHvdZqWoK6ZsdkP=G4A@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAHYJk3RZ_1pcJEfJjUqT8P+kxrEOqBudHvdZqWoK6ZsdkP=G4A@mail.gmail.com>
06.01.2015, 03:21, "Mikael Magnusson" <mikachu@xxxxxxxxx>:
> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author