[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <5051A0A2020000780009AF6B@nat28.tlf.novell.com>
Date: Thu, 13 Sep 2012 08:00:18 +0100
From: "Jan Beulich" <JBeulich@...e.com>
To: "Randy Dunlap" <rdunlap@...otime.net>
Cc: "Linus Walleij" <linus.walleij@...aro.org>,
"Grant Likely" <grant.likely@...retlab.ca>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] allow gpiolib to be a module
>>> On 12.09.12 at 19:41, Randy Dunlap <rdunlap@...otime.net> wrote:
> On 09/12/2012 12:43 AM, Jan Beulich wrote:
>>>>> On 11.09.12 at 19:38, Linus Walleij <linus.walleij@...aro.org> wrote:
>>> On Mon, Sep 10, 2012 at 2:16 PM, Jan Beulich <JBeulich@...e.com> wrote:
>>>> + return gpiolib_sysfs_init() ?: gpiolib_debugfs_init();
>>>
>>> I can't parse this, sorry the gpio subsystem maintainer is too bad coder.
>>> What about something more readable?
>>>
>>> int ret;
>>>
>>> ret = gpiolib_sysfs_init();
>>> if (ret)
>>> return ret;
>>> return gpiolib_debugfs_init();
>>>
>>> I know it doesn't look as cool but it's easier for me to understand.
>>
>> Okay, since you're the second one to complain despite there
>> being other uses of the construct in the same source file, I'll
>> replace it, ...
>
>
> Does C just use the value generated from the left side of a ?:
> expression for the middle (empty) expression or does it call the
> function again (which would usually be bad)?
It's the purpose of omitting the middle expression to avoid the
second evaluation of that expression (and obviously the compiler
can't generally do this on its own when seeing the same
expression used twice).
Jan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists