Re: dsm use of uint64

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Noah Misch <noah(at)leadboat(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: dsm use of uint64
Date: 2013-11-04 15:55:30
Message-ID: 20131104155530.GG25546@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-11-04 10:46:06 -0500, Robert Haas wrote:
> On Fri, Nov 1, 2013 at 11:45 PM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
> > On Mon, 2013-10-28 at 12:17 -0400, Robert Haas wrote:
> >> On Sun, Oct 27, 2013 at 11:34 PM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> >> > On Fri, Oct 25, 2013 at 10:11:41PM -0400, Robert Haas wrote:
> >> >> When I wrote the dynamic shared memory patch, I used uint64 everywhere
> >> >> to measure sizes - rather than, as we do for the main shared memory
> >> >> segment, Size. This now seems to me to have been the wrong decision;
> >
> > This change is now causing compiler warnings on 32-bit platforms. You
> > can see them here, for example:
> > http://buildfarm.postgresql.org/cgi-bin/show_stage_log.pl?nm=lapwing&dt=2013-11-01%2020%3A45%3A01&stg=make
>
> Ah. This is because I didn't change the format code used to print the
> arguments; it's still using UINT64_FORMAT, but the argument is now a
> Size. What's the right way to print out a Size, anyway?

There isn't a nice one currently. glibc/gcc have %z that automatically
has the right width, but that's not supported by windows. I've been
wondering if we shouldn't add support for that just like we have added
support for %m.

> Should I
> just try %lu? It seems that sysv_shmem.c uses %lu, but also casts the
> value to (unsigned long); I could follow that precedent here, if
> there's no consistency to what format is needed to print a size_t.

Yes, you need a cast like that.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-11-04 16:09:35 Re: Fast insertion indexes: why no developments
Previous Message Peter Eisentraut 2013-11-04 15:52:56 Re: Removal of archive in wal_level