Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Should I convert FORTRAN code to C? Summary: sarcasm is not nice, especially when you're wrong Message-ID: <427@proxftl.UUCP> Date: 5 Jul 88 22:27:36 GMT References: <2742@utastro.UUCP> <20008@beta.UUCP> <224@raunvis.UUCP> <861@garth.UUCP> Organization: Proximity Technology, Ft. Lauderdale Lines: 14 In article <861@garth.UUCP>, smryan@garth.UUCP (Steven Ryan) writes: > I have seen the error of my ways! I now see that similarity of casting > (int)(1.2) to (struct a*)(struct-b*-value). Obviously truncating an floating > point number is the same as accessing the identical bit pattern as two > distinct structs. The expression (int)(1.2) means convert the floating point constant to an integer. This involves a representation change. The expression (struct a *)b, where b is a pointer to a struct b, also involves a representation change. For technical reasons, almost all compilers represent all structure pointers the same, thus making the representation change the identity transformation. The cast you mentioned is of POINTERS, not structures. In fact, casting a structure is not legal in C.