Displaying 2 results from an estimated 2 matches for "define_pointer_vector_type".
2023 Feb 22
1
[libnbd PATCH v3 05/29] vector: (mostly) factor out DEFINE_VECTOR_EMPTY
On 2/22/23 09:17, Richard W.M. Jones wrote:
> On Tue, Feb 21, 2023 at 05:23:52PM +0100, Laszlo Ersek wrote:
>> This is doable, but I hope it's not expected that
>> DEFINE_POINTER_VECTOR_TYPE() *enforce* that the element type be a pointer :)
>
>
> You might ignore this for a first draft, but it is apparently possible
> to statically detect this (at least, if using GCC/clang):
>
> https://stackoverflow.com/questions/19255148/check-if-a-macro-argument-is-a-pointer-or-...
2023 Feb 22
2
[libnbd PATCH v3 05/29] vector: (mostly) factor out DEFINE_VECTOR_EMPTY
...purely additive and precisely as
> >> generic/specific as it needs to be. We already have 11 use cases, so I
> >> don't think it's *too* specific.
> >
> > We may still want some division of:
> >
> > DEFINE_VECTOR_TYPE (int_vector, int);
> > DEFINE_POINTER_VECTOR_TYPE (string_vector, char *, free);
> >
> > where under the hood, DEFINE_POINTER_VECTOR_TYPE(type, base, fn)
> > invokes both DEFINE_VECTOR_TYPE(type, base) and
> > DEFINE_VECTOR_EMPTY(type, fn), or whatever we name the second
> > function.
I quite like Eric's suggest...