Re: [IDEA+RFC] Possible solution for min()/max() war

Jonathan Lundell (jlundell@pobox.com)
Fri, 31 Aug 2001 00:43:52 -0700


At 3:19 AM +0200 2001-08-31, Peter T. Breuer wrote:
>?? I don't follow this at all. Typeof is deterministic, since the
>gcc computer program is deterministic. Typeof MUST return the type of
>the expression to which it applies. All expressions in C have
>precisely computed types -I guess what you are saying is that that
>the type of an expression may be context dependent, which I can easily
>imagine in a random computer language, but seriously doubt for C.
>C really does type calculations via narrowing :-o! Oh yeah!
>
>Show me an instance of an expression that two differnt types depending
>on context. I am prepared to be surprised, but dubious.

OK.

At 1:27 AM +0200 2001-08-31, Peter T. Breuer wrote:
>// standard good 'ol faithful version
>#define __MIN(x,y) ({\
> typeof(x) _x = x; \
> typeof(y) _y = y; \
> _x < _y ? _x : _y ; \
> })

How about typeof(__MIN(u, s)), given unsigned u, int s?

-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/