All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Jason Gunthorpe
	<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Cc: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] ipoib: fix hard_header return value
Date: Wed, 27 Mar 2013 10:04:50 -0400	[thread overview]
Message-ID: <5152FC82.6000106@redhat.com> (raw)
In-Reply-To: <20130326181634.GB22775-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

On 03/26/2013 02:16 PM, Jason Gunthorpe wrote:
> On Tue, Mar 26, 2013 at 09:46:28AM -0700, Roland Dreier wrote:
>>> Checkpatch recommends since some time to use sizeof(e) instead of sizeof e,
>>> isn't it ?
>>
>> I actually prefer "sizeof e" since sizeof is an operator, not a
>> function.  "sizeof(e)" looks just as silly as "return(e)" to me.
> 
> Sizeof is used as an expression, return is not.
> 
> They have different precedence rules:
>  return e + 1; // == return (e + 1)
> vs
>  sizeof e + 1;  // == sizeof(e) + 1
> 
> Or weirder:
>  return (void *)x; // OK
> vs
>  sizeof (void *)x; // <-- compile error
> 
> Coding sizeof as a function call frees the reader from having to
> check/know the obscure precedence rules for sizeof.

Personally, I couldn't care less.  But about 5 lines outside of the
context of this patch in the same function is another use of that same
expression.  The real reason I used the form I did was to match the
style of that other instance.  I prepared a separate patch to convert
both of them to the checkpatch preferred style until I saw Roland say he
didn't want it.  But what I wouldn't have done is submitted a patch that
caused a single function to have two different styles within 8 lines of
each other just because some nanny state nag script tells me too.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-03-27 14:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26 16:24 [PATCH] ipoib: fix hard_header return value Doug Ledford
     [not found] ` <3fde29b99442969e59a7a9cf4f63a26858f00a0a.1364315061.git.dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-03-26 16:40   ` Bart Van Assche
     [not found]     ` <5151CF60.3010100-HInyCGIudOg@public.gmane.org>
2013-03-26 16:46       ` Roland Dreier
     [not found]         ` <CAG4TOxPa+B1=N8DUPf4E1AT-a__Yx=3d83d1xA6H5pPW=9TabA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-26 16:52           ` Doug Ledford
2013-03-26 18:16           ` Jason Gunthorpe
     [not found]             ` <20130326181634.GB22775-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2013-03-27 14:04               ` Doug Ledford [this message]
2013-04-01 21:25   ` Or Gerlitz
     [not found]     ` <CAJZOPZKFT6QT_=bfzp0BN42hxgd4A-t0s7d_TBxD=u=Bgcuvgw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-23 16:22       ` Doug Ledford

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=5152FC82.6000106@redhat.com \
    --to=dledford-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=bvanassche-HInyCGIudOg@public.gmane.org \
    --cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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.
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.