Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666901
| From | Dawid Kurek <dawikur@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] drm: Reduce scope of 'state' variable |
| Date | 2017-06-15 19:00 +0200 |
| Message-ID | <tSGhH-4U2-7@gated-at.bofh.it> (permalink) |
| References | <tSAvE-1ng-13@gated-at.bofh.it> <tSAYF-1Mg-9@gated-at.bofh.it> <tSDWy-3yH-13@gated-at.bofh.it> <tSEIW-46h-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] drm: Reduce scope of 'state' variable Dawid Kurek <dawikur@gmail.com> - 2017-06-15 12:50 +0200
Re: [PATCH] drm: Reduce scope of 'state' variable Jani Nikula <jani.nikula@linux.intel.com> - 2017-06-15 13:20 +0200
Re: [PATCH] drm: Reduce scope of 'state' variable Dawid Kurek <dawikur@gmail.com> - 2017-06-15 16:30 +0200
Re: [PATCH] drm: Reduce scope of 'state' variable Jani Nikula <jani.nikula@linux.intel.com> - 2017-06-15 17:20 +0200
Re: [PATCH] drm: Reduce scope of 'state' variable Dawid Kurek <dawikur@gmail.com> - 2017-06-15 19:00 +0200
csiph-web