This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [v3] ctype<char>::is(const char* __low, const char* __high, mask* __vec) const throw()



You're right.

> 
> > ! 	int __i = 0; // Lowest bitmask.
> > ! 	while (__i < __bitmasksize && !(__m & static_cast<mask>(1 << __i)))
> > ! 	  ++__i;
> > ! 	*__vec = static_cast<mask>(1 << __i);
> > !       }
> 
> I don't understand this change; it seems that you're changing the function
> to only output the first value that applies, so that for the letter 'A' the
> output mask would only have the isupper bit set (and not, say, the isalpha
> bit).  Surely the old code was correct?

It was correct for table-based ctypes (of which gnu-linux is a member.) 
I've reverted this patch, and added testcases so that this will be a 
regression if it ever comes back. For non-table based approaches, it was 
never correct. I've made a generic implementation, perhaps it will work 
for these platforms.


> > ===================================================================
> > +   VERIFY ( i01 != i02 != i03 != i04 != i05 != i06 != i07 != i08 != i09 );
> 
> C doesn't work this way.

Fixed.

thanks,
benjamin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]