Re: [Stlport-devel] type of groupsize
Brought to you by:
complement
From: François D. <fra...@fr...> - 2008-04-16 19:32:10
|
Sorry to have paraphrase you Uli. Bests Ulrich Eckhardt wrote: > On Tuesday 15 April 2008, Petr Ovtchenkov wrote: > >> This may be a problem: >> >> + char groupsize = 0; // Size of the current group. >> ... >> + if ((groupsize <= 0) || (groupsize >= cur_group - first) || >> + (groupsize == CHAR_MAX)) >> >> because native char may be as signed as unsigned. int is correct type >> here, IMO. >> > > I think that's ok because char is also the element type of the > string 'grouping', and those checks are just what the standard requires. Of > course, it will never be less than zero when char is unsigned, but that > shouldn't change anything. > > The string 'grouping' is in fact a vector of integer values which contain the > number of digits in each group. You can use CHAR_MAX, zero or negative values > to make a group unbounded. Using negative ones is ugly and doesn't make much > sense IMHO, but it is explicitly allowed and shouldn't cause problems. > > I have PPC-based machine which uses an unsigned char type at home and I'll run > the unit tests, just to be sure. > > Uli > > |