[net.lang.c] Typedefs in casts

kirk (04/01/83)

    Could someone please explain to me why the cast operator does
not know about typedefs.
    I recently had some code with the line

        foo = (ushort)((bar * constant) + bar2))

where ushort was a typedef for unsigned short, foo was defined as a ushort
and bar and bar2 were chars. The code compiled cleanly but at link 
time I got the error message

        undefined _ushort

A quick change to

        foo = (UCOUNT)((bar * constant) + bar2))

where UCOUNT is defined to be unsigned short compiles and links correctly.
Why is this so different to the error case.

(Please no flames about the use of casts, the code is not mine.)

Thanks, Dave Kirkpatrick

mat (04/03/83)

	When you report a question, bug, etc, looking for info or help,
	you will help your own cause by telling your audience WHAT COMPILER
	and RELEASE you are using.  If you have access to several, you may
	want to try it on all of them.  Contrary to popular belief, there
	does not exist one C language, any more than WNCN broadcasts at
	104.3 MHz.  NCN broadcasts on a band CENTERED AT 104.3 MHz.  C
	is a collection of languages, each defined by the compiler that
	accepts and compiles it.  The same is true of FORTRAN, Pascal, PL/1,
	COBOL, Lisp, etc.  We can't help you if we don't know what you have
	got to work with.
							Mark Terribile
							DoDN

							-!hou5e!mat