[net.lang.c] No Subject

@ge-crd.arpa:davidsen@crdos1.uucp (01/10/86)

Received: by kbsvax.steinmetz (4.12/1.1x Steinmetz)
	id AA16252; Fri, 10 Jan 86 10:35:02 est
Date: Fri, 10 Jan 86 10:35:02 est
From: <davidsen@crdos1.UUCP>
Posted-Date: Fri, 10 Jan 86 10:35:02 est
Message-Id: <8601101535.AA16252@kbsvax.steinmetz>
To: davidsen@crdos1.UUCP, kbsvaxD!info-c@brl-tgr.ARPA

in <8511182341.AA02971@seismo.CSS.GOV> "Niket K. Patwardhan" writes:

>How many times do people have to go over this? Perhaps the problem is that
>people don't understand what a cast does!
>
>A cast does NOT change the bit pattern! As a matter of fact, it is a means
>of preventing a conversion that DOES change the bit pattern! A cast simply
>changes the PRESUMED type of a stored bit-pattern, without changing the
>pattern itself.
>
>I hope this clarifies things. If you point me at example compilers that do
>different things with casts, then I would say those compilers are wrong!

True, people don't understand what a cast does, particularly you. There are
two useful references to C, neither of which is really a standard, but both
of which agree on what a cast does. Consider page 42 of K&R "The C
Programming Language". It *clearly* says that a cast has the same effect as
an assign to a variable of the casted type! A cast really does change the
bit pattern, otherwise there would be no reason to do it!

A cast forces a type conversion to the casted type to eliminate the need
for an assignment to get the same effect. In the X3J11 proposed standard
the type coersion for procedure arguments, the arguments are forced to be
the correct type. The change of assumed type you (attempt to) describe is
called a "union", which allows what you suggest.

I don't normally bother to reply to hate mail, but since you posted your
original reply to the net (as a carbon, so I didn't notice for a few
months), and since you were so vitriolic and patronizing (and so wrong), I
decided to reply, and to post my reply to the net also.

Thank you for informing me that there was an X3J11 proposed standard. I was
aware of it, since I was on the committee for the first two years of its
existance.