Ovanes Markarian wrote:

> Robert, somehow I do not get your proposal. How do you consider an
> if-branch, which is not going to compile, i.e. compilation error. Do
> you propose, to ignore that branch and just state: "OK, if there is a
> compilation error, that must be eliminated without any errors to the
> end-user". I don't think this can work. Therefore there should be a
> special language construct, which states: "if there is a compilation
> error, than it is safe to be ignored during the compilation"  
 
whatever I said - what I mean is illustrated by the following
 
if(0){
    ; // not checked by the compiler
}
 
and of course the same would occur for any expression
which resulted in a 0 or false at compile time.
 
 > Sorry it took me a bit longer, but here are my ideas....
> Code from Slide 12 of Andrei's presentation at Going Native 2012:
>
>
> template<class T>
> struct container
> {
>   ...
>   static if(debug_mode<T>::value)
>   {
>     class const_iterator { ... };
>     static if(std::is_const<T>::value)
>     {
>       typedef const_iterator iterator;
>     }
>     else
>     {
>       class iterator { ... };
>     }
>   }
>   else
>   {
>     class const_iterator { ... };
>     clas iterator { ... };
>   }
> };
>
and my view would be that removing the "static" wouldn't change
anything in the program - so why is it necessary.
 
> template<class PointerWrapper>
> struct grab_pointer_type
> {
>   static if(has_element_type<PointerWrapper>::value)
>   {
>     typedef typename PointerWrapper::element_type pointer_type;
>   }
>   else
>   {
>     typedef typename PointerWrapper::value_type pointer_type;
>   }
> };
 
also in this example, removing the static wouldn't change the
program in any way.
 
The only problem comes about when the dead code won't
compile.  Just skipping the dead code would fix this problem.
 
btw - andrei left it as an open question whether the compiler
should try to parse the dead code or just throw it away.
 
Robert Ramey