This is the mail archive of the libc-alpha@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]

Re: [patch] Fix BZ 19165 -- overflow in fread / fwrite


On Mon, 26 Oct 2015, Paul Pluzhnikov wrote:

> static inline bool
> __attribute__ ((__always_inline))
> __umull_overflow (size_t a, size_t b)

I don't approve of function naming that quietly embeds the assumption that 
size_t and unsigned long have the same set of values.

If you want a multiplication function for size_t, whether saturating or 
setting an explicit overflow flag, then the name should make clear that 
it's for size_t.  And if you use __builtin_umull_overflow in the 
implementation, you should also have a static assertion that SIZE_MAX == 
ULONG_MAX.

-- 
Joseph S. Myers
joseph@codesourcery.com


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