From: Linus Torvalds > Sent: 28 July 2024 18:25 > > On Sun, 28 Jul 2024 at 07:18, David Laight <David.Laight@xxxxxxxxxx> wrote: > > > > +#define min_t(type, x, y) __careful_cmp(min, (type)(x), (type)(y)) > > +#define max_t(type, x, y) __careful_cmp(max, (type)(x), (type)(y)) > > This is unrelated to your patch, but since it moves things around and > touches these, I reacted to it.. > > We should *not* use __careful_cmp() here. > > Why? Because part of __careful_cmp() is the "only use arguments once". > > But *another* part of __careful_cmp() is "be careful about the types" > in __cmp_once(). > > And being careful about the types is what causes horrendous expansion, > and is pointless when we just forced things to be the same type. > > So we should split __careful_cmp() into one that does just the "do > once" and one that then also does the type checking. ... Yes I've seen that and left well alone :-) Or rather, left it until after MIN() and MAX() are used for constants. Although min_t(type,x,y) should just be type __x = x; type __y = y; __x < __y ? __x : __y; Absolutely no point doing anything else. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)