On Fri, 14 Sep 2001, eric pouech wrote:
just for fun, I tried compiling Wine with Linux latest
min/max macros
definitions
I think it's an excellent idea. But there are some problems with
their macros: we have duplicate consts :-(
Example in controls/edit.c:1575
*x = min(max(*x, es->format_rect.left), es->format_rect.right-1);
*y = min(max(*y, es->format_rect.top), es->format_rect.bottom-1);
edit.c: In function `EDIT_ConfinePoint':
edit.c:1575: warning: duplicate `const'
edit.c:1576: warning: duplicate `const'
Still I think it would be a good idea to put them in windef.h on a
more permanent basis. What about the attached patch?
* removed the consts
* added a WINE_MINMAX for WineLibe applications that would want to use
this feature
* removed the undefs and using the same #ifndef for both
How does all this sound?
PS:
Alternately we may be able to keep the consts if we cast the result
to typeof(x) (or y). Because in the above case it is because max returns
a 'const int' instead of an int that we have a problem. 'const ints' are
pretty rare otherwise (I think).
--
Francois Gouget fgouget(a)free.fr
http://fgouget.free.fr/
Cahn's Axiom: When all else fails, read the instructions.