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

Michael Stefaniuc mstefani at redhat.com
Fri Feb 5 12:10:53 CST 2010


Henri Verbeet wrote:
> On 5 February 2010 18:19, Matteo Bruni <matteo.mystral at gmail.com> wrote:
>> Sure. Better to go with something like "len = len < (desc->size -
>> desc->pos) ? len : desc->size - desc->pos" or creating a "min"
>> function?
>>
> 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.

bye
	michael



More information about the wine-devel mailing list