All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dawid Kurek <dawikur@gmail.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: Reduce scope of 'state' variable
Date: Thu, 15 Jun 2017 18:56:51 +0200	[thread overview]
Message-ID: <20170615165651.GA695@gmail.com> (raw)
In-Reply-To: <87vanxxp5h.fsf@intel.com>

On 15/06/17, Jani Nikula wrote:
> On Thu, 15 Jun 2017, Dawid Kurek <dawikur@gmail.com> wrote:
> > On 15/06/17, Jani Nikula wrote:
> >> Separate declaration and initialization would lead to a cleaner patch
> >> and result.
> >
> > I saw combining declaration and initialization is quite common, i.e. in
> > drm_atomic file. Personally, I also prefer those in one statement. But yes, it
> > looks cleaner here, in two lines.
> 
> I'd say the rule of thumb is that combined declaration and
> initialization is fine if the initialization is trivial, in particular
> can never fail. If you need to check the return value, like in this
> case, I'd prefer separate initialization.
> 
Yeah, makes sense. If you need to check then it exceeds simple initialization,
and then it is not declare&initialize. Yes, now I see it.

Thanks a lot,
Dawid

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Dawid Kurek <dawikur@gmail.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>,
	Sean Paul <seanpaul@chromium.org>,
	David Airlie <airlied@linux.ie>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm: Reduce scope of 'state' variable
Date: Thu, 15 Jun 2017 18:56:51 +0200	[thread overview]
Message-ID: <20170615165651.GA695@gmail.com> (raw)
In-Reply-To: <87vanxxp5h.fsf@intel.com>

On 15/06/17, Jani Nikula wrote:
> On Thu, 15 Jun 2017, Dawid Kurek <dawikur@gmail.com> wrote:
> > On 15/06/17, Jani Nikula wrote:
> >> Separate declaration and initialization would lead to a cleaner patch
> >> and result.
> >
> > I saw combining declaration and initialization is quite common, i.e. in
> > drm_atomic file. Personally, I also prefer those in one statement. But yes, it
> > looks cleaner here, in two lines.
> 
> I'd say the rule of thumb is that combined declaration and
> initialization is fine if the initialization is trivial, in particular
> can never fail. If you need to check the return value, like in this
> case, I'd prefer separate initialization.
> 
Yeah, makes sense. If you need to check then it exceeds simple initialization,
and then it is not declare&initialize. Yes, now I see it.

Thanks a lot,
Dawid

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

  reply	other threads:[~2017-06-15 16:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-15 10:41 [PATCH] drm: Reduce scope of 'state' variable Dawid Kurek
2017-06-15 10:41 ` Dawid Kurek
2017-06-15 11:09 ` Jani Nikula
2017-06-15 11:09   ` Jani Nikula
2017-06-15 14:24   ` Dawid Kurek
2017-06-15 14:24     ` Dawid Kurek
2017-06-15 15:10     ` Jani Nikula
2017-06-15 15:10       ` Jani Nikula
2017-06-15 16:56       ` Dawid Kurek [this message]
2017-06-15 16:56         ` Dawid Kurek

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=20170615165651.GA695@gmail.com \
    --to=dawikur@gmail.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.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.