Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jan 2015 19:40:33 +0000
From:      "Robert N. M. Watson" <rwatson@FreeBSD.org>
To:        Joerg Sonnenberger <joerg@britannica.bec.de>
Cc:        svn-src-all@freebsd.org
Subject:   Re: svn commit: r277203 - in head/sys: kern sys
Message-ID:  <AAB6DA30-A9BA-43A6-9624-2231FBAB596C@FreeBSD.org>
In-Reply-To: <20150115123557.GC7669@britannica.bec.de>
References:  <201501142344.t0ENi0tI088747@svn.freebsd.org> <20150115123557.GC7669@britannica.bec.de>

next in thread | previous in thread | raw e-mail | index | archive | help

> On 15 Jan 2015, at 12:35, Joerg Sonnenberger <joerg@britannica.bec.de> =
wrote:
>=20
> On Wed, Jan 14, 2015 at 11:44:00PM +0000, Robert Watson wrote:
>>  - As we anticipate embedding mbufs headers within variable-size =
regions of
>>    memory in the future, change the definitions of byte arrays =
embedded in
>>    mbufs to be of size [0] rather than [MLEN] and [MHLEN].
>=20
> This is not valid C. You may be able to use flexible array members =
([])
> instead.

Life is not that simple -- see the Phabricator review discussion which =
considers this point in detail. The short version is: using [] for the =
last entry in a union within a structure is explicitly disallowed in the =
C spec, actually works fine with [0] in gcc + extensions, which are a =
feature used in the kernel already. If in doubt, try replacing [0] with =
[] and recompiling, it's an instructive and morally improving process. =
We will want to feed this back to the C standardisation folk at some =
point.

Robert=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AAB6DA30-A9BA-43A6-9624-2231FBAB596C>