Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #6849

Re: Integer promotions, conversions, coercions and templates :( (Conclusion)

From "MikeP" <mp011011@some.org>
Newsgroups comp.lang.c++
Subject Re: Integer promotions, conversions, coercions and templates :( (Conclusion)
Date 2011-06-17 09:49 -0500
Organization A noiseless patient Spider
Message-ID <itfpif$ff7$1@dont-email.me> (permalink)
References (4 earlier) <84a9f141-c56d-4a72-92d0-bd1250397901@q17g2000vby.googlegroups.com> <itd4u2$34g$1@dont-email.me> <34b59459-2560-40ac-9970-4b56ea3bf10e@e21g2000vbz.googlegroups.com> <itfk5g$ar1$1@dont-email.me> <19599704-119a-43de-953b-8748f8f75522@v5g2000vbm.googlegroups.com>

Show all headers | View raw


Michael DOUBEZ wrote:
> On 17 juin, 15:17, "MikeP" <mp011...@some.org> wrote:
>> Michael DOUBEZ wrote:
>>>>>>> template <typename T, unsigned int W = numeric_limit<T>::digits
>>>>>>> > bool CheckBit(T& mask, unsigned n)
>>>>>>> {
>>>>>>> static_assert( is_integral<T>::value && is_unsigned<T>::value );
>>>>>>> // assert n in range
>>>>>>> const T mask_n = T(1) << (n-1ui32);
>>>>>>> return mask & mask_n != 0;
>>>>>>> }
>>
>>>>>> How is that more clear than using zero and the width of the
>>>>>> unsigned integer type in the assertion?
>>
>>>>> The static assert ensures the range of template type parameters is
>>>>> limited to unsigned integral type.
>>
>>>> Too much machinery for such a simple need. Too obfuscating also.
>>
>>> True. I would have prefered concepts but AFAIS we won't get them for
>>> another decade now.
>>
>> IOW, never! (Because that is beyond C++'s lifespan potential).
>
> I disagree.

That there will never be concepts in C++ or that C++'s life has less than 
10 years left?

> We will need 2 years to get c++11 compliant compilers, 7
> more years to get them main stream in production. Yet another 5 years
> to get people trained using it and transfer it into the culture.
>

>>>>>>> Better to put as little as possible in the macro.
>>
>>>>>> I have used the "generate unique names with a macro for
>>>>>> macro-based templates so much though, that it is a well-tested
>>>>>> and accepted technique.
>>
>>>>> And one I use extensively together with code generation of the
>>>>> super macro. And even after two years of using it, I find it
>>>>> unclear, hard to debug and a pain to read.
>>
>>>> Don't know what to tell ya. It works great for me. Nary a problem.
>>
>>> We don't have the same problem space.
>>
>> I don't see that as an issue, but I'm assuming you mean that
>> proverbial "large scale project".
>
> I said problem space not problem scale.

"large scale projects" can be viewed as "a space".

>
> In fact, IMHO the right solution would have been code generation but
> that raised other problems such as variabilities specifications.
>
> [snip]
>
>>
>>>> Super
>>>> macros allow stepping into and debugging whereas a traditional
>>>> macro (all on one line with line continuation chars) are hard to
>>>> debug. I probably have a more evolved way of handling the issues.
>>
>>> The tools available are a bit dated but I didn't expect a debugger
>>> could step into a macro definition.
>>
>> That is what "super macros" afford you. It's their biggest selling
>> point. Perhaps you don't know what I meant with "super macro"? A web
>> search will probably find it for you.
>
> Actually, it did not

Here ya go: http://s11n.net/papers/supermacros_cpp.html



Back to comp.lang.c++ | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-08 17:09 -0500
  Re: Integer promotions, conversions, coercions and templates :( Ian Collins <ian-news@hotmail.com> - 2011-06-09 10:22 +1200
    Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-08 17:49 -0500
    Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-08 19:13 -0500
      Re: Integer promotions, conversions, coercions and templates :( Ian Collins <ian-news@hotmail.com> - 2011-06-09 14:32 +1200
        Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-09 07:30 -0500
          Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-09 06:18 -0700
            Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-09 08:45 -0500
              Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-09 06:51 -0700
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-09 13:44 -0500
          Re: Integer promotions, conversions, coercions and templates :( Ian Collins <ian-news@hotmail.com> - 2011-06-10 07:37 +1200
            Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-09 15:11 -0500
              Re: Integer promotions, conversions, coercions and templates :( Ian Collins <ian-news@hotmail.com> - 2011-06-10 09:09 +1200
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-09 17:15 -0500
                Re: Integer promotions, conversions, coercions and templates :( Ian Collins <ian-news@hotmail.com> - 2011-06-10 10:40 +1200
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-10 05:07 -0500
                Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-10 03:14 -0700
                Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-10 03:19 -0700
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-10 06:08 -0500
                Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-10 04:32 -0700
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-10 07:14 -0500
                Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-10 05:27 -0700
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-10 07:35 -0500
                Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-10 06:47 -0700
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-10 06:18 -0500
                Re: Integer promotions, conversions, coercions and templates :( Ian Collins <ian-news@hotmail.com> - 2011-06-11 08:08 +1200
                Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-10 18:41 -0500
    Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-10 08:11 -0500
  Re: Integer promotions, conversions, coercions and templates :( Öö Tiib <ootiib@hot.ee> - 2011-06-09 06:28 -0700
    Re: Integer promotions, conversions, coercions and templates :( "MikeP" <mp011011@some.org> - 2011-06-09 08:50 -0500
  Re: Integer promotions, conversions, coercions and templates :( (Summary so far) "MikeP" <mp011011@some.org> - 2011-06-10 08:40 -0500
    Re: Integer promotions, conversions, coercions and templates :( (Summary so far) Öö Tiib <ootiib@hot.ee> - 2011-06-10 07:14 -0700
      Re: Integer promotions, conversions, coercions and templates :( (Summary so far) "MikeP" <mp011011@some.org> - 2011-06-10 09:17 -0500
    Re: Integer promotions, conversions, coercions and templates :( (Summary so far)(Corrections and more) "MikeP" <mp011011@some.org> - 2011-06-10 09:14 -0500
      Re: Integer promotions, conversions, coercions and templates :( (Results: Generated Code) "MikeP" <mp011011@some.org> - 2011-06-10 12:43 -0500
  Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-14 18:35 -0500
    Re: Integer promotions, conversions, coercions and templates :( (Conclusion) Ian Collins <ian-news@hotmail.com> - 2011-06-15 12:51 +1200
      Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-15 08:45 -0500
    Re: Integer promotions, conversions, coercions and templates :( (Conclusion) Michael DOUBEZ <michael.doubez@free.fr> - 2011-06-15 03:33 -0700
      Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-15 09:17 -0500
        Re: Integer promotions, conversions, coercions and templates :( (Conclusion) Michael DOUBEZ <michael.doubez@free.fr> - 2011-06-16 04:17 -0700
          Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-16 09:45 -0500
            Re: Integer promotions, conversions, coercions and templates :( (Conclusion) Michael DOUBEZ <michael.doubez@free.fr> - 2011-06-17 01:56 -0700
              Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-17 07:58 -0500
                Re: Integer promotions, conversions, coercions and templates :( (Conclusion) Michael DOUBEZ <michael.doubez@free.fr> - 2011-06-17 06:54 -0700
                Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-17 09:19 -0500
              Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-17 08:17 -0500
                Re: Integer promotions, conversions, coercions and templates :( (Conclusion) Michael DOUBEZ <michael.doubez@free.fr> - 2011-06-17 07:33 -0700
                Re: Integer promotions, conversions, coercions and templates :( (Conclusion) "MikeP" <mp011011@some.org> - 2011-06-17 09:49 -0500

csiph-web