DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Olivier Matz <olivier.matz@6wind.com>
Cc: Thomas Monjalon <thomas@monjalon.net>, dev <dev@dpdk.org>,
	 "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Bing Zhao <bingz@nvidia.com>, Xiaoyun Li <xiaoyun.li@intel.com>
Subject: Re: [dpdk-dev] [PATCH] ethdev: warn only once for badly behaving applications
Date: Wed, 27 Oct 2021 10:42:15 +0200	[thread overview]
Message-ID: <CAJFAV8yCYKYyN0Of2MSBHoq1=wA+G=AezDTHDCSX9sFAq+3CDQ@mail.gmail.com> (raw)
In-Reply-To: <YXkKwpILAopmV/mF@platinum>

On Wed, Oct 27, 2021 at 10:16 AM Olivier Matz <olivier.matz@6wind.com> wrote:
> > Do you have the explanation or can you point me at some standard
> > explaining the difference in treatment?
>
> Let me try an explanation, hope it is the correct one.
>
> In the first case, this is an assignment as described in 6.5.16 of
> the standard [1]:
>
>   *fpo = (struct rte_eth_fp_ops) { .rx_pkt_burst = dummy_eth_rx_burst, ... };
>
> The compiler expects the right side to be an expression. The expression
> is a "compound literal", as described in 6.5.2.5:
>
>  1. The type name shall specify a complete object type or an array of
>     unknown size, but not avariable length array type.
>  2. All the constraints for initializer lists in 6.7.9 also apply to
>     compound literals
>
> The second cast { ..., .rxq = (struct rte_ethdev_qdata) { ... } } is
> inside a construction that behaves like an initialization (according to
> the second point above). The compiler already knows the type of the
> struct (and therefore the types of the fields), so the cast is not
> required.
>
> [1] http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf

I read/understand it like this too.
Thanks a lot, reading standards is always illuminating.


-- 
David Marchand


  reply	other threads:[~2021-10-27  8:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 14:58 David Marchand
2021-10-26 15:56 ` Thomas Monjalon
2021-10-27  7:20   ` David Marchand
2021-10-27  8:16     ` Olivier Matz
2021-10-27  8:42       ` David Marchand [this message]
2021-10-26 17:10 ` Ananyev, Konstantin
2021-10-27  7:23   ` David Marchand
2021-10-27 12:01 ` [dpdk-dev] [PATCH v2] ethdev: warn once for buggy applications David Marchand
2021-10-27 12:15   ` Ananyev, Konstantin
2021-10-27 12:46     ` Thomas Monjalon
2021-10-27 17:31       ` Ferruh Yigit

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='CAJFAV8yCYKYyN0Of2MSBHoq1=wA+G=AezDTHDCSX9sFAq+3CDQ@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=thomas@monjalon.net \
    --cc=xiaoyun.li@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;
as well as URLs for NNTP newsgroup(s).