home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!mole-end!mat
- From: mat@mole-end.matawan.nj.us
- Subject: Re: Covariant Types in Derived Classes
- Message-ID: <1992Aug13.162956.10279@mole-end.matawan.nj.us>
- Summary: (Open request to Bjarne, ARK, and other Gurus)
- Organization: :
- References: <1992Aug8.210716.14741@ucc.su.OZ.AU> <713504630snx@trmphrst.demon.co.uk>
- Date: Thu, 13 Aug 1992 16:29:56 GMT
- Lines: 58
-
- I'm afraid we are victims of diverging terminology here.
-
- Let's try to get some convergence:
-
- Conversion: The creation of a value in one type
- corresponding _somehow_ to a value in
- another type. (Exception, sort of: A
- conversion to void in C or C++ creates a
- _lack of a value_ corresponding vacuously to
- a value in another type. A zero-to-every
- mapping, so to speak.)
-
- Cast: A C and C++ construct that can demand either
- a conversion _within_ the type system
- (e.g. (int) 3.14159 ) or a conversion that
- bypasses the type system (e.g (char*) 0x30EA ).
-
- In article <713504630snx@trmphrst.demon.co.uk>, nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
- > In article <1992Aug8.210716.14741@ucc.su.OZ.AU> maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
- > > In article <713221684snx@trmphrst.demon.co.uk> nikki@trmphrst.demon.co.uk (Nikki Locke) writes:
-
- > > >No - some casts are fine - e.g. ...
- > > >Casting a built-in arithmetic type to a larger type to avoid arithmetic
- > > > overflow.
- > > This is NOT a cast (in my terminology), but a value producting
- > > conversion. ...
-
- Mercy even for Pooh-Bah!
-
- Open letter to the Gurus of C++: Is there a preferred
- terminology for expressing `this stuff'? Can one be
- created for the present need? There's been more than one
- discussion locked in violent agreement for want of it.
-
- > By the way, what is
- > int x;
- > long z;
- >
- > x = (int)z;
- >
- > Is this a cast, or a conversion ? (I want a warning anyway, please).
-
- It is a conversion that is indicated syntactically by a cast.
-
- Why do you want a warning? You asked for it explicitly and it lies
- within the type system. There's an important principle here: for
- every construct that can produce a warning, there must be a way to
- write an equivalent construct that does _not_ produce the warning.
- This is part and parcel of the C/C++ philosophy that ``if you _really_
- want to do that, we'll take you at your word.''
-
- The code fragment written _without_ the cast might very well merit a
- warning about value truncation.
- --
- (This man's opinions are his own.)
- From mole-end Mark Terribile
-
- mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ
-