Linus Torvalds writes: (Summary)
I think all the existing users are of type "max_t()" anyway due to the
very same issue, no?
very same issue, no?
At least if there's an explicit type like 'size_t', then passing in "-1" becoming a large unsigned integer is understandable and clear, not just some odd silent behavior.
not just some odd silent behavior.
Put another way: I think it's unacceptable that
Put another way: I think it's unacceptable that
const_max(-1,6)
const_max(-1,6)
magically becomes a huge positive number like in that patch of yours, but magically becomes a huge positive number like in that patch of yours, but const_max_t(size_t, -1, 6)
const_max_t(size_t, -1, 6)
*obviously* is a huge positive number.
*obviously* is a huge positive number.
The two things would *do* the same thing, but in the second case the type is explicit and visible.
type is explicit and visible.
That sounds acceptable too, although the
very same issue, no?
At least if there's an explicit type like 'size_t', then passing in "-1" becoming a large unsigned integer is understandable and clear, not just some odd silent behavior.
not just some odd silent behavior.
Put another way: I think it's unacceptable that
Put another way: I think it's unacceptable that
const_max(-1,6)
const_max(-1,6)
magically becomes a huge positive number like in that patch of yours, but magically becomes a huge positive number like in that patch of yours, but const_max_t(size_t, -1, 6)
const_max_t(size_t, -1, 6)
*obviously* is a huge positive number.
*obviously* is a huge positive number.
The two things would *do* the same thing, but in the second case the type is explicit and visible.
type is explicit and visible.
[...]
this is rejected:That sounds acceptable too, although the