On 05/15/2014 05:25 AM, Dongsheng Yang wrote:
>>> +# define CLAMP(v, min, max) ({ \
>> This is gcc-specific. I'd rather avoid it, and stick to portable C99
>> code, if possible - which means doing this as an inline function rather
>> than a macro.
>
> I prefer inline function too, but I found MAX and MIN are implemented
> with macro, then
> appended CLAMP to them.
>
> Okey, I will use inline function in next version if this patch is
> acceptable.Martin's suggestion of using MIN(MAX()) is also C99 compliant, and usable as a macro. For this particular code, a macro is preferable to an inline function, because it is type-agnostic. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
