Re: Definitions of Typecast etc.

"Joachim Durchholz" <joachim_d@gmx.de>
25 Feb 2001 11:00:57 -0500

          From comp.compilers

Related articles
Definitions of Typecast etc. vbdis@aol.com (2001-02-04)
Re: Definitions of Typecast etc. rkrayhawk@aol.com (2001-02-15)
Re: Definitions of Typecast etc. vbdis@aol.com (2001-02-17)
Re: Definitions of Typecast etc. rkrayhawk@aol.com (2001-02-23)
Re: Definitions of Typecast etc. joachim_d@gmx.de (Joachim Durchholz) (2001-02-25)
| List of all articles for this month |
From: "Joachim Durchholz" <joachim_d@gmx.de>
Newsgroups: comp.compilers
Date: 25 Feb 2001 11:00:57 -0500
Organization: Compilers Central
References: 01-02-035
Keywords: types
Posted-Date: 25 Feb 2001 11:00:57 EST

VBDis <vbdis@aol.com> wrote:
>
> Can someone help me with according explanations? What other English
> terms may be related to type casts? Which term would describe most
> clearly the difference between a value-preserving type cast, and a
> value-changing type conversion?


Even a type cast need not preserve the value. (char) 0xFFFF will usually
get you 0xFF. (real) (unsigned long) 0xffffffff will lose significant
digits, as will (real) (some double). Strictly speaking, even 1.0 and 1
are not "the same value": you can divide the former by 2 and get an
accurate result, while you cannot do the same with the latter.


Getting back to the original question: I know of no good terminology for
lossy and lossless conversions. But even a lossless conversion changes
the available properties of a value, and it's easy to make errors here,
so I treat lossless conversions with the same suspicion as lossy
conversions and don't need precise terminology to differentiate between
the two cases :)


Regards,
Joachim


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.