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(buf, sizeof(buf)) >= sizeof(buf)) >
note that the >= operator promotes int to size_t, which makes the cast useless and could permit lines to be shortened.