[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH 03/13] Rewrite virAtomic APIs using GLib's atomic ops code



On 07/16/2012 09:45 AM, Daniel P. Berrange wrote:
> On Fri, Jul 13, 2012 at 03:44:03PM -0600, Eric Blake wrote:
>> On 07/11/2012 07:35 AM, Daniel P. Berrange wrote:
>>> From: "Daniel P. Berrange" <berrange redhat com>
>>>
>>> There are a few issues with the current virAtomic APIs
>>>

>>> +
>>> +#  define virAtomicIntGet(atomic)               \
>>> +    virAtomicIntGet((int *)atomic)
>>
>> What are these macro casts for?  You are not properly parenthesizing
>> things, and didn't the glib definition already check that the right size
>> was being passed in?
> 
> With the inline GCC macros we can pass either 'int' or 'unsigned int'
> with no warnings. When we use the WIn32/pthread helper functions though,
> we would get compiler warnings from mixed-sign ints. These macro casts
> get around that.

Fair enough, but a comment in the code before the defines would go a
long way to help the next reader.  Looking forward to v2.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]