On Thu, May 08, 2014 at 18:43, Alexandre Ratchov wrote:
> On Thu, May 08, 2014 at 12:35:56PM -0400, Ted Unangst wrote:
>> This is wrong in several ways.
>>
>> Never cast sizeof down, always cast the comparison variable up.
>>
>> I'll specifically call out this change:
>>
>> -if (snprintf(buf
On 08 May 2014, at 18:43, Alexandre Ratchov wrote:
> On Thu, May 08, 2014 at 12:35:56PM -0400, Ted Unangst wrote:
>> This is wrong in several ways.
>>
>> Never cast sizeof down, always cast the comparison variable up.
>>
>> I'll specifically call out this change:
>>
>> -if (snprintf(buf, s
On Thu, May 08, 2014 at 12:35:56PM -0400, Ted Unangst wrote:
> This is wrong in several ways.
>
> Never cast sizeof down, always cast the comparison variable up.
>
> I'll specifically call out this change:
>
> - if (snprintf(buf, sizeof(buf)) >= (int)sizeof(buf))
> + if ((size_t)snprintf
This is wrong in several ways.
Never cast sizeof down, always cast the comparison variable up.
I'll specifically call out this change:
- if (snprintf(buf, sizeof(buf)) >= (int)sizeof(buf))
+ if ((size_t)snprintf(buf, sizeof(buf)) >= sizeof(buf))
The top way fails when snprintf retur