Re: [PATCH] notmuch-show: use correct format specifier for ssize_t

Subject: Re: [PATCH] notmuch-show: use correct format specifier for ssize_t

Date: Fri, 5 Feb 2021 22:20:55 +0700

To: Tomi Ollila

Cc: notmuch@notmuchmail.org

From: Đoàn Trần Công Danh


On 2021-02-02 19:52:20+0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Mon, Feb 01 2021, David Bremner wrote:
> 
> > Đoàn Trần Công Danh <congdanhqx@gmail.com> writes:
> >
> >> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
> >> ---
> >>
> >>  I found this after inspecting one of my build today.
> >>  I'm not sure what is acceptable action.
> >>  I think using %zd is the right move.
> >>  But I'm not sure if you prefer to case ssize to long int.
> >>
> >
> > If I understand correctly %zd is glibc specific? Is there a more portable way
> > to do this? Maybe that's what you meant by the cast.
> 
> printf(3) is not too clear about that, In one place I understand
> %z is "SUSv3" compatible (what that says is something vague, perhaps just
> post C99), and in one place it says glibc 2.1 adds support for 'z' (but
> perhaps since it is in standard already) 

Sorry for my late reply.
Yes %z is standard compliant, it's available from at least C99.
POSIX talks about it somewhere around that period
https://pubs.opengroup.org/onlinepubs/009695399/functions/fprintf.html

-- 
Danh
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: