Subject: Re: [PATCH 01/10] ivec: introduce the C side of ivec

From: Junio C Hamano <[email-masked]>
Date: Wed, 21 Jan 2026 13:31:51 -0800

Jeff King <[email-masked]> writes:

> On Wed, Jan 21, 2026 at 02:00:15PM -0700, Ezekiel Newren wrote:
>
>> What about adding clar unit tests to make sure that different ivec
>> types have the same size and layout? e.g. sizeof(IVec_c_void) ==
>> sizeof(IVec_u8);
>> sizeof(IVec_c_void) == sizeof(IVec_u16);
>> sizeof(IVec_c_void) == sizeof(IVec_u32);
>> sizeof(IVec_c_void) == sizeof(IVec_u64);
>> ...
>> 
>> As well as other tests for ivec.
>
> I'm a little hesitant in general to have run-time tests for properties
> around undefined behavior, just because the compiler is allowed to do a
> lot of tricky things when we get into that territory. Plus it is not
> really _solving_ the problem, but perhaps just alerting us slightly
> sooner than the production code itself crashing and burning.

Yup, by definition, testing undefined behaviour with code is more or
less pointless.  Implementation defined behaviour, maybe, but not
undefined ones, please.

I thought you already gave them that having different possibilities
in a union would work correctly, but perhaps I was reading a
different thread?  I dunno...