From: Jeff King Date: Sat, 29 Nov 2025 10:50:23 GMT Subject: Re: [PATCH] last-modified: fix bug caused by inproper initialized memory Message-ID: <20251129105023.GA646133@coredump.intra.peff.net> In-Reply-To: <5699f2cc-5157-441e-af98-4d8df492ec72@mit.edu> On Fri, Nov 28, 2025 at 02:20:22PM -0800, Anders Kaseorg wrote: > On 11/28/25 12:55, Jeff King wrote: > > In the same vein, probably using "sizeof(lm->scratch->words)" is better > > than "sizeof(eword_t)". But again, I find it an unlikely detail for us > > to catch under the hood. > > As words is a pointer, you must have meant sizeof *lm->scratch->words or > sizeof lm->scratch->words[0]. Whoops, yes. I prefer sizeof(*var) over sizeof(type) because it tracks changes to the type of "var" automatically. But the opportunity to forget the "*" is perhaps a point against it. :) -Peff