stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: openSUSE 10.2 -- gcc 4.1.1/2 -- valarray
Date Mon, 19 Mar 2007 15:45:44 GMT
Scott Zhong wrote:
> would this be sufficient enough of a fix on valarray?

It would most likely be sufficient in practice but strictly
speaking, the single underscore followed by a lowercase
letter is only reserved for global symbols and not for
members. It would also be inappropriate the stdcxx naming
convention calls for the _C_ prefix for names of reserved
members.

As I said, I have a patch that fixes these naming problems
(in addition to other bugs) that I've been planning to check
in for a few weeks. Hopefully I'll find the time to do it
this week.

Martin

PS When posting changes like the diff below it's better to
use the unified format (it provides context).

> 
> 1301c1301
> <           _C_slice(__rhs.get_slice())
> ---
>>           _C_slice(__rhs._get_slice())
> 1314c1314
> <     slice get_slice () const {
> ---
>>     slice _get_slice () const {
> 1467c1467
> <           _C_slice (__rhs.get_slice ())
> ---
>>           _C_slice (__rhs._get_slice ())
> 1481c1481
> <     gslice get_slice () const {
> ---
>>     gslice _get_slice () const {
> 1520c1520
> <           _C_valarray (__rhs.get_array ())
> ---
>>           _C_valarray (__rhs._get_array ())
> 1532c1532
> <     valarray<bool> get_array () const {
> ---
>>     valarray<bool> _get_array () const {
> 1536c1536
> <     const valarray<bool>* get_array_pt () const {
> ---
>>     const valarray<bool>* _get_array_pt () const {
> 1627c1627
> <        _C_valarray (__sl.get_array ())
> ---
>>        _C_valarray (__sl._get_array ())
> 1640c1640
> <     valarray<_RWSTD_SIZE_T> get_array () const {
> ---
>>     valarray<_RWSTD_SIZE_T> _get_array () const {
> 1644c1644
> <     const valarray<_RWSTD_SIZE_T>* get_array_pt () const {
> ---
>>     const valarray<_RWSTD_SIZE_T>* _get_array_pt () const {
> 1737c1737
> <     _STD::slice __slice           = __lhs.get_slice ();
> ---
>>     _STD::slice __slice           = __lhs._get_slice ();
> 1757c1757
> <     _STD::slice __slice           = __lhs.get_slice ();
> ---
>>     _STD::slice __slice           = __lhs._get_slice ();
> 1778c1778
> <     const _STD::valarray<bool> &__vlray = *__lhs.get_array_pt ();
> ---
>>     const _STD::valarray<bool> &__vlray = *__lhs._get_array_pt ();
> 1795c1795
> <     const _STD::valarray<bool> &__vlray = *__lhs.get_array_pt ();
> ---
>>     const _STD::valarray<bool> &__vlray = *__lhs._get_array_pt ();
> 1812c1812
> <     const _STD::valarray<_RWSTD_SIZE_T> &__vlray = *__lhs.get_array_pt
();
> ---
>>     const _STD::valarray<_RWSTD_SIZE_T> &__vlray = *__lhs._get_array_pt
();
> 1829c1829
> <     const _STD::valarray<_RWSTD_SIZE_T> &__vlray = *__lhs.get_array_pt
();
> ---
>>     const _STD::valarray<_RWSTD_SIZE_T> &__vlray = *__lhs._get_array_pt
();
> 2077c2077
> <         _RW::__rw_array <_TypeT>(_TypeT (), sl_ar.get_slice ().size());
> ---
>>         _RW::__rw_array <_TypeT>(_TypeT (), sl_ar._get_slice ().size());
> 2079c2079
> <     _RWSTD_SIZE_T __i = sl_ar.get_slice().start();
> ---
>>     _RWSTD_SIZE_T __i = sl_ar._get_slice().start();
> 2082c2082
> <     while( __cpt < sl_ar.get_slice().size() )
> ---
>>     while( __cpt < sl_ar._get_slice().size() )
> 2085c2085
> <         __i+= sl_ar.get_slice().stride();
> ---
>>         __i+= sl_ar._get_slice().stride();
> 2098c2098
> <         _RW::__rw_array <_TypeT>(_TypeT (), sl_ar.get_slice ().size());
> ---
>>         _RW::__rw_array <_TypeT>(_TypeT (), sl_ar._get_slice ().size());
> 2100c2100
> <     _RWSTD_SIZE_T __i = sl_ar.get_slice().start();
> ---
>>     _RWSTD_SIZE_T __i = sl_ar._get_slice().start();
> 2103c2103
> <     while( __cpt < sl_ar.get_slice().size() )
> ---
>>     while( __cpt < sl_ar._get_slice().size() )
> 2106c2106
> <       __i+= sl_ar.get_slice().stride();
> ---
>>       __i+= sl_ar._get_slice().stride();
> 2144c2144
> <     gslice sl(sl_ar.get_slice());
> ---
>>     gslice __sl(sl_ar._get_slice());
> 2147c2147
> <         _RW::__rw_array <_TypeT>(_TypeT (), sl.ind_numb());
> ---
>>         _RW::__rw_array <_TypeT>(_TypeT (), __sl.ind_numb());
> 2149c2149
> <     _RWSTD_SIZE_T __i = sl.next_ind();
> ---
>>     _RWSTD_SIZE_T __i = __sl.next_ind();
> 2152c2152
> <     while( !sl.is_reseted() )
> ---
>>     while( !__sl.is_reseted() )
> 2155c2155
> <       __i= sl.next_ind();
> ---
>>       __i= __sl.next_ind();
> 2167c2167
> <     gslice sl(sl_ar.get_slice());
> ---
>>     gslice __sl(sl_ar._get_slice());
> 2170c2170
> <         _RW::__rw_array <_TypeT>(_TypeT (), sl.ind_numb());
> ---
>>         _RW::__rw_array <_TypeT>(_TypeT (), __sl.ind_numb());
> 2172c2172
> <     _RWSTD_SIZE_T __i = sl.next_ind();
> ---
>>     _RWSTD_SIZE_T __i = __sl.next_ind();
> 2175c2175
> <     while( !sl.is_reseted() )
> ---
>>     while( !__sl.is_reseted() )
> 2178c2178
> <       __i= sl.next_ind();
> ---
>>       __i= __sl.next_ind();
> 2215,2216c2215,2216
> <     mask_array<_TypeT>  *msk = _RWSTD_CONST_CAST (mask_array<_TypeT>*,
&__rhs)
> ;
> <     const valarray<bool>*sec = msk->get_array_pt();
> ---
>>     mask_array<_TypeT>  *__msk = _RWSTD_CONST_CAST (mask_array<_TypeT>*,
&__rh
> s);
>>     const valarray<bool>*__sec = __msk->_get_array_pt();
> 2220,2221c2220,2221
> <     for(__i = 0; __i < sec->size(); __i++)
> <         if ( (*sec)[__i]) __n++;
> ---
>>     for(__i = 0; __i < __sec->size(); __i++)
>>         if ( (*__sec)[__i]) __n++;
> 2227,2228c2227,2228
> <     for( __i=0; __i < sec->size(); __i++ )
> <       if ( (*sec)[__i]) __tmp[__cpt++] = (*(__rhs.get_ref_mem_array()))[__i];
> ---
>>     for( __i=0; __i < __sec->size(); __i++ )
>>       if ( (*__sec)[__i]) __tmp[__cpt++] = (*(__rhs.get_ref_mem_array()))[__i]
> ;
> 2238,2239c2238,2239
> <     mask_array<_TypeT>  *msk = _RWSTD_CONST_CAST (mask_array<_TypeT>*,
&__rhs)
> ;
> <     const valarray<bool>*sec = msk->get_array_pt();
> ---
>>     mask_array<_TypeT>  *__msk = _RWSTD_CONST_CAST (mask_array<_TypeT>*,
&__rh
> s);
>>     const valarray<bool>*__sec = __msk->_get_array_pt();
> 2243,2244c2243,2244
> <     for (__i = 0; __i < sec->size(); __i++)
> <         if ((*sec)[__i])
> ---
>>     for (__i = 0; __i < __sec->size(); __i++)
>>         if ((*__sec)[__i])
> 2251,2252c2251,2252
> <     for( __i=0; __i < sec->size(); __i++ )
> <       if ( (*sec)[__i]) __tmp[__cpt++] = (*(__rhs.get_ref_mem_array()))[__i];
> ---
>>     for( __i=0; __i < __sec->size(); __i++ )
>>       if ( (*__sec)[__i]) __tmp[__cpt++] = (*(__rhs.get_ref_mem_array()))[__i]
> ;
> 2294c2294
> <     const valarray<_RWSTD_SIZE_T> *__sec = __ia->get_array_pt();
> ---
>>     const valarray<_RWSTD_SIZE_T> *__sec = __ia->_get_array_pt();
> 2315c2315
> <     const valarray<_RWSTD_SIZE_T> *__sec = __ia->get_array_pt();
> ---
>>     const valarray<_RWSTD_SIZE_T> *__sec = __ia->_get_array_pt();
> 
> 
> Yu (Scott) Zhong
> 
> 
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com]
> Sent: Sun 3/18/2007 1:54 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: openSUSE 10.2 -- gcc 4.1.1/2 -- valarray
>  
> Scott Zhong wrote:
>> do you suggest we do this to valarray?
>>
>> cat t.cpp && gcc -v && gcc t.cpp && ./a.out
>> class _slice
> 
> std::slice et al are required by the standard. I was referring
> to the get_slice() member function which isn't. A program that
> does
> 
>      #define slice !ERROR!
>      #include <valarray>
> 
> is ill-formed, but a program that does
> 
>      #define get_slice !ERROR!
>      #include <valarray>
> 
> is not.
> 
>> {
>> public:
>>         _slice () : a(0), b(0), c(0) { }
>>         _slice (int _a, int _b, int _c) 
> 
> Names with a single leading underscore followed by a lowercase
> letter are reserved for use as global names, so while that alone
> prevents programs from #defining macros that look like that it
> doesn't make such names reserved to the implementation. I don't
> think there's a way to detect local variables that are in
> violation of this requirement. Nevertheless, the convention
> for local variables is two leading underscores, i.e., __a,
> __b, and __c above.
> 
> Martin
> 
> 


Mime
View raw message