typedef laxity

Mike Light mlight at hpiacla.HP.COM
Thu Apr 14 06:20:27 AEST 1988


<>>It seems to me someone should complain about this code:
<>>
<>>	typedef int TEMPERATURE;
<>>	typedef int PRESSURE;
<>>
<>>	TEMPERATURE tx, ty;
<>>	PRESSURE px, py;
<>>
<>>	ty = py;		/* type clash */

{Well, I have gotten several mail messages and seen several followups all
{saying the same thing:  "That's just the way it works."  As opposed to
{saying "It works this way because of <insert good idea>".

Typedef is little different than a macro substitution for type definitions.
It wasn't meant to create a "new" type somehow different or incompatible
with other types.  Sounds to me like you need Pascal.

{Larry Campbell                                The Boston Software Works, Inc.

Mike Light -- Hewlett-Packard Co.   ..!hpda!hpiacla!mlight



More information about the Comp.lang.c mailing list