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: Avoid some left-shifts of negative constants


On 2/7/19 9:14 AM, Joseph Myers wrote:
If the code is doing left shifts of
negative values, that may well indicate an unsigned type would have made
the intended semantics clearer, even if a signed type does work in that
code.

Although that might be true elsewhere, there is a reasonable argument that the code is clearer as-is for this particular case, as it's more robust in the presence of integer-width changes. I'd like to see cases where the code is obviously clearer after being rewritten to use unsigned shifts, before conceding that it's worthwhile to spend time to pacify -Wshift-negative-value.


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