All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Bhumika Goyal <bhumirks@gmail.com>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH 4/5] Staging: lustre: Use min_t or max_t instead of ternary operator
Date: Mon, 22 Feb 2016 13:10:57 -0800	[thread overview]
Message-ID: <20160222211057.GA5849@kroah.com> (raw)
In-Reply-To: <ae653a4fe839af60c62a545477d803c8b0866968.1456136671.git.bhumirks@gmail.com>

On Mon, Feb 22, 2016 at 04:15:33PM +0530, Bhumika Goyal wrote:
> Replace ternary operators with macros min_t/max_t as they are 
> shorter and thus increases code readability. Macro min_t return the minimum
> and min_t returns maximum of the two compared values.
> Made a semantic patch for changes:
> 
> @@
> type T;
> T x;
> T y;
> @@
> (
> - x < y ? x : y
> + min_t(T,x,y)
> |
> - x > y ? x : y
> + max_t(T,x,y)
> )

If they are the same type, why can't you just use min() and max()?  The
call to min_t() and max_t() seem a bit of an overkill as they do an
explicit cast for when the types of the two variables are not the same
type.

So I'd prefer this patch to just be min() and max() if at all possible.

thanks,

greg k-h


  parent reply	other threads:[~2016-02-22 21:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 10:45 [PATCH 0/5] Staging: Replace ternary operators with min_t/max_t Bhumika Goyal
2016-02-22 10:45 ` [PATCH 1/5] Staging: rtl8723au: Use macro min_t instead of ternary operator Bhumika Goyal
2016-02-22 10:45 ` [PATCH 2/5] Staging: rdma: " Bhumika Goyal
2016-02-22 10:45 ` [PATCH 3/5] Staging: gdm724x: Use " Bhumika Goyal
2016-02-22 10:45 ` [PATCH 4/5] Staging: lustre: Use min_t or max_t " Bhumika Goyal
2016-02-22 12:40   ` [Outreachy kernel] " Julia Lawall
2016-02-22 13:33     ` Bhumika Goyal
2016-02-22 21:10   ` Greg KH [this message]
2016-02-23  3:43     ` Bhumika Goyal
2016-02-22 10:45 ` [PATCH 5/5] Staging: rts5208: Use min_t " Bhumika Goyal
2016-02-22 21:11 ` [Outreachy kernel] [PATCH 0/5] Staging: Replace ternary operators with min_t/max_t Greg KH

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=20160222211057.GA5849@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=bhumirks@gmail.com \
    --cc=outreachy-kernel@googlegroups.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.