Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site harvard.ARPA Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!whuxl!houxm!ihnp4!mhuxn!mhuxr!ulysses!allegra!mit-eddie!genrad!panda!talcott!harvard!macrakis From: macrakis@harvard.ARPA (Stavros Macrakis) Newsgroups: net.micro,net.lang Subject: Re: Unchecked conversion in Ada Message-ID: <203@harvard.ARPA> Date: Thu, 20-Jun-85 20:19:52 EDT Article-I.D.: harvard.203 Posted: Thu Jun 20 20:19:52 1985 Date-Received: Sun, 23-Jun-85 00:47:38 EDT References: <1649@reed.UUCP> <186@harvard.ARPA> <453@calmasd.UUCP> <192@harvard.ARPA> <266@sdcc13.UUCP> <197@harvard.ARPA> <2323@sun.uucp> Organization: Aiken Comp. Lab., Harvard Lines: 20 Xref: watmath net.micro:10838 net.lang:1626 > > ...converts between...two types bit-to-bit; something like C's casts. > C casts are not bit-for-bit conversions unless the conversion happens > to be implemented as such... I would put it differently: C casts ARE bit-for-bit conversions except sometimes for numerical types. To the extent that one can speak of C having any semantics at all, this makes the semantics of C casts grossly inconsistent. For instance, (int) 2.3 == 2, but (*var=2.3, *((int *) var) ) == garbage; I don't even want to begin to think about the semantics of conversions involving unsigned's. I also don't understand what `happens to be implemented as' means. What other possibilities are there for converting pointers to integers, incompatible pointers, etc.? So perhaps it was a bad idea to compare Unchecked_conversion in Ada to C casts. I just wanted to use a reference point familiar to C users. -s