[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/x86: Use min macro instead of ternary operator

On Sun, Mar 29, 2020 at 12:08:39PM +0100, Julien Grall wrote:
> Hi,
> On 29/03/2020 08:22, Simran Singhal wrote:
> > Replace ternary operator with macro min as it is shorter and
> > thus increases code readability. Macro min return the minimum of the
> > two compared values.
> While I understand the ternary operator is doing exactly the same as a
> min(), I read the current code as "If there is an error then return the
> error code, otherwise return 0".
> This is quite different from the meaning of "min" which is "I want the
> minimum of the two values". Therefore I am not convinced using min() is the
> right thing to do.

I agree with Julien's assessment.




Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.