Re: Missing SIZE_MAX

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@postgreSQL.org
Date: 2017-09-01T15:50:47Z
Lists: pgsql-hackers
Tom Lane wrote:

> We have a workaround for that symbol in timezone/private.h:
> 
> #ifndef SIZE_MAX
> #define SIZE_MAX ((size_t) -1)
> #endif
> 
> and a bit of grepping finds other places that are using the (size_t) -1
> trick explicitly.  So what I'm tempted to do is move the above stanza
> into c.h.

Sounds good to me.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Commits

  1. Make [U]INT64CONST safe for use in #if conditions.

  2. Ensure SIZE_MAX can be used throughout our code.

  3. Teach libpq to detect integer overflow in the row count of a PGresult.