5 Feb
2010
5 Feb
'10
12:10 p.m.
Henri Verbeet wrote:
On 5 February 2010 18:19, Matteo Bruni <matteo.mystral(a)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