News for hackers. Stuff that matters.
Re:Maximal Min() and Max() by colonwqbang on Thursday August 08, 2024 @05:03PM (#41196243)
Genericity is not really the issue as I see it. The basic K&R macro using ?: is fully generic. The problem is that C has implicit conversion between essentially any numeric types. The main point of the kernel macro was to prevent such conversions.

I think implicit type conversion is a mistake, perhaps one of the few true design flaws in C. Languages like haskell and rust went with explicit conversions which is probably a better idea overall, even if it does increase the code verbosity a bit. C++ instead doubled down and added many more ways for implicit conversions to happen.

Re:Maximal Min() and Max() by PaulDavisThe1st on Friday August 09, 2024 @12:43PM (#41203422)
> C++ instead doubled down and added many more ways for implicit conversions to happen.

but also allows you to turn them off for objects, thankfully.