CPP Check 1.1.31

Michael Stefaniuc mstefani at redhat.com
Mon Oct 12 15:40:45 CDT 2009


On 10/12/2009 10:36 PM, James McKenzie wrote:
> Nikolay Sivov wrote:
>> James McKenzie wrote:
>>> Nikolay Sivov wrote:
>>>
>>>> James McKenzie wrote:
>>>>
>>>>> Nikolay Sivov wrote:
>>>>>
>>>>>
>>>>>> chris ahrendt wrote:
>>>>>>
>>>>>>> [/home/cahrendt/wine-git/dlls/kernel32/resource.c:1279]: (error)
>>>>>>> Division by zero
>>>>>>>
>>>>>> False positive I suppose:
>>>>>>
>>>>>> ---
>>>>>>     static const BYTE pad[] = {
>>>>>>
>>>>>> 'P','A','D','D','I','N','G','X','X','P','A','D','D','I','N','G' };
>>>>>>     DWORD i;
>>>>>>
>>>>>> ->     for ( i = 0; i<  size / sizeof pad; i++ )
>>>>>> ---
>>>>>>
>>>>> Should pad be enclosed in parenthesis?
>>>>>
>>>>> James McKenzie
>>>>>
>>>> No, why?
>>>>
>>>>
>>>>
>>> I was thinking that c specifies sizeof needs the parameter to be
>>> enclosed in parathesis like this sizeof (pad) but I may be incorrect.
>>>
>>> James McKenzie
>>>
>> This is for type names, variables could be used without enclosing.
>>
>>
> Thank you for the clarification on the use of sizeof.
sizeof is not a function but an operator. Thus the same rules apply to 
it as to other operators. People just like to write sizeof as a function.

bye
	michael



More information about the wine-devel mailing list