Re: [dev] st: Large pile of code

From: Kent Overstreet <>
Date: Wed, 24 Apr 2013 17:42:43 -0700

On Wed, Apr 24, 2013 at 2:14 PM, <> wrote:
> On Wed, Apr 24, 2013, at 15:32, Kent Overstreet wrote:
>> I switched to gnu99 for typeof() - it makes it possible to write min
>> and max macros that don't evaluate their arguments twice, and IMO is a
>> very worthwhile extension.
> Wait, you switched _to_ gnu99? For _that_?


> A) Why do min and max need to be macros at all? Also, where do you call
> them on anything that's not an int?
> B) Where do you call them on anything that has side effects (i.e. that
> _needs_ to not be evaluated twice)?

Honestly, I don't really care to bikeshed over this - but, making
function or a macro that did evaluate its arguments twice would a) be
_inviting_ bugs, tripping people up who are used to correctly
implemented min() and max() elsewhere, and b) these versions are
relatively standard (the Linux kernel, and it's one of the things the
kernel gets right, IMO).

If people are actually using compilers that don't support typeof, I'll
just rip out all the min and max usage - better that than doing it

Oh, it's not just min and max that use typeof, swap() too (and I think
I use swap more).
Received on Thu Apr 25 2013 - 02:42:43 CEST

This archive was generated by hypermail 2.3.0 : Thu Apr 25 2013 - 02:48:05 CEST