Andres Freund <and...@anarazel.de> writes: > On 2016-10-05 09:38:15 +0900, Michael Paquier wrote: >> The existing interface of MemoryContextAlloc do not care much about >> anything except Size, so I'd just give the responsability to the >> caller to do checks like queue != (Size) queue when queue is a uint64 >> for example.
> Well, that duplicates the check and error message everywhere. It seems like you're on the edge of reinventing calloc(), which is not an API that anybody especially likes. The problem with trying to centralize overflow handling is that there are too many different cases. calloc() handles exactly one case, where the request is to be a product of exactly two inputs that are individually not capable of overflowing. As best I can follow what you've got in mind here, it would be equally likely to cover only a subset of cases. regards, tom lane -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers