[vlc-devel] [RFC v4] vlc_vector: add helpers for vectors
Rémi Denis-Courmont
remi at remlab.net
Sat Sep 1 11:16:54 CEST 2018
Le perjantaina 31. elokuuta 2018, 22.48.17 EEST Romain Vimont a écrit :
> On Fri, Aug 31, 2018 at 06:46:05PM +0300, Rémi Denis-Courmont wrote:
> > Le perjantaina 31. elokuuta 2018, 15.04.52 EEST Romain Vimont a écrit :
> > > +#define vlc_vector_realloc_(pv, newsize) \
> > > +( \
> > > + vlc_vector_reallocarray_((void **) &(pv)->data, newsize, \
> > > + sizeof(*(pv)->data)) && \
> >
> > I strongly suspect a violation of type aliasing with the cast to void **.
>
> I agree that this looks suspicious regarding the strict aliasing rules:
> a pointer to type* (type**) is deferenced via a pointer to void*
> (void**).
>
> The standard says:
> > An object shall have its stored value accessed only by an lvalue
> > expression that has one of the following types:
> > - a type compatible with the effective type of the object,
I know what strict aliasing is.
> I'm not sure about the definition of "compatible", but I would say that
> type* and void* are compatible types.
No, unless type is void, they are not.
--
レミ・デニ-クールモン
http://www.remlab.net/
More information about the vlc-devel
mailing list