From: Jani Nikula <jani.nikula@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/selftests: Fix uninitialized variable
Date: Wed, 04 Mar 2020 22:50:26 +0200 [thread overview]
Message-ID: <8736anq1yl.fsf@intel.com> (raw)
In-Reply-To: <875zfkph5o.fsf@intel.com>
On Wed, 04 Mar 2020, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Tue, 03 Mar 2020, Matt Roper <matthew.d.roper@intel.com> wrote:
>> On Tue, Mar 03, 2020 at 05:25:21PM +0200, Jani Nikula wrote:
>>> On Tue, 03 Mar 2020, Aditya Swarup <aditya.swarup@intel.com> wrote:
>>> > - struct lrc_timestamp data;
>>> > + struct lrc_timestamp data = { 0 };
>>>
>>> {} is preferred over {0}.
>>
>> Is there a reference for this (e.g., in the kernel coding style)? I
>> thought this came up a couple years ago and the consensus was the other
>> way, although I could be misremembering. Unless it's changed in a
>> recent standard, I think {} is only legal in C++, so using it in C code
>> is a gcc-ism?
>
> Both are widely used in the kernel. I think we've mostly converged to {}
> in i915. Yes, it's a gcc-ism in C code, but the kernel is gcc, not
> standard C.
>
> I can't find a reference right now, but ISTR there are some warnings
> issued in some cases with the {0} initializer, depending on the struct
> and perhaps on the compiler.
Here's one [1].
BR,
Jani.
[1] http://patchwork.freedesktop.org/patch/msgid/20200304183654.GA9011@paulmck-ThinkPad-P72
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2020-03-04 20:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 14:23 [Intel-gfx] [PATCH] drm/i915/selftests: Fix uninitialized variable Aditya Swarup
2020-03-03 15:25 ` Jani Nikula
2020-03-03 20:30 ` Matt Roper
2020-03-04 10:07 ` Jani Nikula
2020-03-04 20:50 ` Jani Nikula [this message]
2020-03-03 18:45 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/selftests: Fix uninitialized variable (rev2) Patchwork
2020-03-03 20:25 ` [Intel-gfx] [PATCH] drm/i915/selftests: Fix uninitialized variable Matt Roper
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=8736anq1yl.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.d.roper@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox