Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!uw-beaver!fluke!kurt From: kurt@tc.fluke.COM (Kurt Guntheroth) Newsgroups: comp.sys.amiga Subject: Re: Amiga programmer's hint $14 Message-ID: <3042@fluke.COM> Date: 3 Mar 88 16:25:13 GMT References: <4230019@hpfclq.HP.COM> <340@sas.UUCP> <707@mcdsun.UUCP> <319@jc3b21.UUCP> Sender: news@tc.fluke.COM Organization: John Fluke Mfg. Co., Inc., Everett, WA Lines: 16 I used to think a cast was a way to unlock the type system in C too, but it turns out not to be. A cast is a type conversion operator and a cast can generate code. For instance, int foo; float bar; bar = (float) foo; should generate code to convert foo to a float. Furthermore, the result of a cast is an rvalue. That is why you can't always use casts on the left side of an assignment. Now, some compilers, like the BSD vax compiler permit this, but others, like the Sun compiler, do not. (Talking to Sun service is how I learned about casts.) There is a relevant chapter and verse in K&R too. Anyone remember where it is? Oh, by the way, this discussion has also been on comp.lang.c.