side-effects/type safe min/max (Was Re: [1/3] d3dx9: Partial implementation of D3DXAssembleShader function. [try 2])

Michael Stefaniuc mstefani at
Fri Feb 5 15:50:53 CST 2010

On 02/05/2010 07:38 PM, Henri Verbeet wrote:
> On 5 February 2010 19:10, Michael Stefaniuc<mstefani at>  wrote:
>> Henri Verbeet wrote:
>>> min and max are already defined in windef.h. Note that they're not
>>> safe for expressions with side-effects, but for simple expressions
>>> like the one here they're ok.
>> We can lift the side-effects and type safe min/max macros from the Linux
>> Kernel. Of course Alexandre would have to accept the use of typeof(); we
>> can do a fallback for the compilers that don't support that.
> I imagine it can't be *that* hard to fix the macros, but wouldn't that
> make them incompatible with the PSDK ones?
Not really, you can guard them with ifdef __WINESRC__. The Wine source 
already has stricter requirements than what the Win32 API would allow.
Of course the real issue is getting to the point where Wine will compile 
without warnings with the strict min/max macros. Actually that was once 
a janitorial task to use the strict min/max macros and fixup the 
problems found by that.


More information about the wine-devel mailing list