incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Zhong" <sco...@roguewave.com>
Subject RE: ctype index?
Date Thu, 05 Apr 2007 16:27:15 GMT
Since __lo is char * which is the input that needs to be narrowed, would
make sense that the for loop should be changed to something like for(;
__lo != NULL; ++__lo).  I don't think incrementing the __hi pointer
wouldn't do much, I believe that __hi is constant "high" value.  Reading
the C++ library drift didn't explain much about the "high" value.  I am
changing the code on my workspace to check the results.

Yu (Scott) Zhong

-----Original Message-----
From: Scott Zhong [mailto:scottz@roguewave.com] 
Sent: Thursday, April 05, 2007 9:27 AM
To: stdcxx-dev@incubator.apache.org
Subject: RE: ctype index?

Right now it is comparing pointer addresses?  __lo and __hi are pointers
and the operation <  for(; __lo < __hi; ++__lo; ++__hi)  > would step
through until the memory address __lo is greater than or equal to __hi?

Yu (Scott) Zhong
Consulting Engineer
Rogue Wave Software, a Quovadxtm division
scottz@roguewave.com
ph: 303 545 3182
 

-----Original Message-----
From: Martin Sebor [mailto:sebor@roguewave.com] 
Sent: Wednesday, April 04, 2007 5:29 PM
To: stdcxx-dev@incubator.apache.org
Subject: Re: ctype index?

Scott Zhong wrote:
> in the for loop, why __lo char_type length isn't being tested?

I'm not sure what you mean. What length isn't being tested
and why should it be?

Martin

> 
> in _ctype.cc line 141:
> 
> template <class _CharT>
> /* virtual */ const _TYPENAME ctype<_CharT>::char_type*
> ctype<_CharT>::
> do_narrow (const char_type *__lo, const char_type *__hi,
>            char __dfault, char *__dest) const
> {
>     _RWSTD_ASSERT (__lo <= __hi);
>     _RWSTD_ASSERT (!__lo || __dest);
> 
>     for (; __lo < __hi; ++__lo, ++__dest)
>         *__dest = narrow (*__lo, __dfault);
> 
>     return __hi;
> }
> 
> 
> Yu (Scott) Zhong
> 
> 


Mime
View raw message