Boost logo

Boost :

From: Victor A. Wagner Jr. (vawjr_at_[hidden])
Date: 2004-02-28 19:41:43


At Saturday 2004-02-28 12:39, you wrote:
>Glen wrote:
>
> > >I guess I don't understand the whole concept now. T* ->
> > void* sounds
> > >like "narrowing", since it loses information. int -> long
> > never loses
> > >information, so "widening" makes sense to me. What is the criterion?
> >
> > This is why I like C++'s choice of base and derived, there's
> > never any confusion. You have the concepts of narrowing and
> > widening correct but backwards. You narrow a type to a more
> > specific derived type and widen one to a more general base type.
>
>That is why we should always use "covariant" and "contravariant"

oh yeah, covariant and contravariant are pellucidly clear </extreme sarcasm>
they also differ by only 3 letters (in the middle) and are hard to read

>conversions, instead of (the proper but potentially confusing - if the
>reader is in "number of bits" mode) "narrowing" and "widening."
>
>This confusion leads to a shock when encountering the pointer-to-pointer
>conversions in C++. One has to understand the oscillation between covariance
>and contravariance when the indirections are traversed.
>
>I will personally spam the next writer using "narrowing" or "widening" ;-)
>
>/David
>
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
The five most dangerous words in the English language:
               "There oughta be a law"


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk