min/max and types

Francois Gouget fgouget at free.fr
Tue Sep 18 17:40:01 CDT 2001


On Tue, 18 Sep 2001, eric pouech wrote:
[...]
> 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)

   But in this last example, wouldn't it be better to declare s as an
int or i as a short? Then we would not need a cast.
   I believe we would rarely be forced to really compare integers of
different sizes. Of course the only way to be sure is to really look at
the actual warnings...


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
     Linux, WinNT, MS-DOS - also known as the Good, the Bad and the Ugly.





More information about the wine-devel mailing list