This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Change maxsize_* and last_* from size_t to uint64_t in memusagestat.c
- From: Holger Freyther <zecke at selfish dot org>
- To: libc-help at sourceware dot org
- Date: Sun, 1 Nov 2009 05:51:06 +0100
- Subject: Re: [PATCH] Change maxsize_* and last_* from size_t to uint64_t in memusagestat.c
- References: <200910301445.04730.zecke@selfish.org> <119aab440910311358x333234c5n1ae472f4523b0ab3@mail.gmail.com>
On Saturday 31 October 2009 21:58:49 Carlos O'Donell wrote:
> On Fri, Oct 30, 2009 at 9:45 AM, Holger Freyther <zecke@selfish.org> wrote:
> > 2009-10-30 Holger Hans Peter Freyther <zecke@selfish.org>
> >
> > * malloc/memusagestat.c (main): Change the type from size_t to
> > uint64_t in maxsize_heap, maxsize_stack, maxsize_total, last_heap,
> > last_stack, last_total to avoid assigning from an unsigned to a signed
> > type.
>
> Same problem as before with your ChangeLog.
>
> The comment is also incorrect. The type size_t is by definition
> unsigned, therefore there should be no assignment from a signed to
> unsigned type.
My bad, I was thinking of ssize_t when writing it.
> What is the actual error message you were seeing?
I was probably trying to fix this[1] and my first step was to fix things that
looked broken to me. I have not seen any compiler warning about possible
trunication though. I think it is safe and sane to use uint64_t instead of
size_t. In one way it feels more natural as struct entry is using it (as you
said).
z.
[1] http://sourceware.org/ml/libc-alpha/2009-10/msg00045.html