This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] libstdc++/21244


Gabriel Dos Reis wrote:

>| Certainly, when complex arithmetic is
>| involved we are going to uglify a lot the code, sigh.
>
>I think I do not understand this part.  Could you elaborate?
>  
>
In the patch I'm working on, there are instances of ""complex""
arithmetic involving the anonymous enums values, example from stl_bvector.h:

      _Bit_type*
      _M_allocate(size_t __n)
      { return _M_impl.allocate((__n + _S_word_bit - 1) / _S_word_bit); }

If I'm not mistaken, since any operator could be potentially overloaded,
we must change it to this:

    _Bit_type*
    _M_allocate(size_t __n)
    { return _M_impl.allocate((__n + int(_S_word_bit) - 1) /
int(_S_word_bit)); }

Agreed?

(actually, the above is the worst case ;)

Paolo.


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