Re: Some efforts to get rid of "long" in our codebase - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Some efforts to get rid of "long" in our codebase
Date
Msg-id b4046cdb-7eb6-4eb4-93e1-c00b7141ee22@eisentraut.org
Whole thread Raw
In response to Some efforts to get rid of "long" in our codebase  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Some efforts to get rid of "long" in our codebase
List pgsql-hackers
On 06.11.25 12:46, David Rowley wrote:
> 0002: MemSet / MemSetAligned macros. It's probably about time someone
> made these disappear, but that's likely for another thread with more
> research than I'd like to do here. I replaced "long" with "Size". I
> also considered "uintptr_t", but after some reading of the C standard,
> I settled on Size as it seems it's possible for platforms to exist
> where the pointer width is smaller than the processor's width. I
> suspect it might not matter for the platforms we support? Size could
> also be smaller than the processor's width, but I feel that's less
> likely.

I think size_t/Size could be misleading here.  You're not measuring any 
size, you're just chunking up the bytes to zero into something that we 
thing the compiler or CPU can handle very efficiently.

So in a sense, using long isn't wrong here.  It might well be the best 
for this.  If there is an aversion to using any long at all, why not 
long long.



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Some efforts to get rid of "long" in our codebase
Next
From: Corey Huinker
Date:
Subject: Re: Extended Statistics set/restore/clear functions.