[comp.lang.c] types and typedefs in C

throopw@xyzzy.UUCP (Wayne A. Throop) (06/27/87)

> mick@auspyr.UUCP (Mick Andrew)
> As far as typedefs go, I fall into the "anti" camp.  If you're looking
> for strong typing use Pascal.  

Interesting.  In fact, C *is* quite strongly typed as algol-descended
languages go.  This is not to be confused with compiler enforcement of
the type rules, nor even the ease of checking all the rules in the
presense of union types.  Nevertheless, C has quite definite type rules,
which are poorly understood by many.

And if you're looking for something without the ability to coin new
names for types, use PL/I subset G.

> #define INTPTR int *
> INTPTR  x,y,z;  /* not what is intended */
> But, typedefs can lead to somewhat analagous problems.  Consider
> typedef  int intarray[6];
> intarray *b;
> We all know where this can lead, right?       :-)

Yes.  It leads to the same place as does 

        intarray (*b)[6];

All in all, a quite straightforward place, if one knows the meaning of
arrays in C.

--
"What's your point?"            --- from Night Court
-- 
Wayne Throop      <the-known-world>!mcnc!rti!xyzzy!throopw