[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: min/max and types
From:       John Alvord <jalvo () mbay ! net>
Date:       2001-09-20 19:15:58
[Download RAW message or body]

On Thu, 20 Sep 2001 21:03:20 +0200, eric pouech
<eric.pouech@wanadoo.fr> wrote:

>(resent because of mail issues)
>
>still thinking about it, there is however some points I don't like (and
>especially for keeping it permanent)
>errors we want to catch are mainly related to sign mismatch
>(like min(char, unsigned short)...)
>
>however, comparaisons like min(short, int) or min(size_t, DWORD) don't
>provide lots of errors. integral promotions are straightforward, and
>behave as expected by any programmer. so it would be rather ugly IMO
>to write something like min((int)s, i) (s being short and i int)
>
>on the other hand, in the case of min(char, unsigned short), only
>experienced programmers are able to tell the order of integral
>promotions
>involved here, and we really do need some guidance here. unfortunately, 
>I don't see any ways not to let the min/max macro only spit errors on 
>integral type of same sign-ness

Another argument in the L-K debate was that precisely the same problem
exists when comparing variables... and comparisons are much more
common then min/max. One person suggested a LE/GT/etc set of #defines
to capture those errors. Not an easy job.

john

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic