This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/13575] SSIZE_MAX defined as LONG_MAX is inconsistent with SIZE_MAX, when __WORDSIZE != 64


https://sourceware.org/bugzilla/show_bug.cgi?id=13575

--- Comment #5 from Eric Blake <eblake at redhat dot com> ---
(In reply to joseph@codesourcery.com from comment #1)
> There is no guarantee that ssize_t is the signed type corresponding to 
> size_t - and you can't safely change types between int and long because 
> that would change the C++ name mangling.

Correct - it is not portable to assume that %zd maps to ssize_t. In fact, there
is NO portable way to print an ssize_t value through printf() without a cast. 
But we aren't talking about portability, but about glibc - and in glibc, we can
take extra care to make sure size_t and ssize_t are the same type, if the
system didn't decide otherwise.

But just because warnings on %zd are insufficient to prove whether there is a
bug does not make it any less a bug.  If glibc knows that ssize_t is an int
(regardless of whether size_t is an unsigned int or unsigned long), then
SSIZE_MAX must also be an expression of type int.  And in C++, with function
overloading, this matters, if I want foo(SSIZE_MAX) to call the correct
overload.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]