typedef laxity

Karl Heuer karl at haddock.ISC.COM
Tue Apr 12 13:38:10 AEST 1988


In article <1071 at maynard.BSW.COM> campbell at maynard.UUCP (Larry Campbell) writes:
>>Typedef simply creates synonyms for a type.
>
>[I know, but] I am arguing that how it works is a _bad thing_.  I would like
>lint, at least, to complain.  Can anyone convince me that it shouldn't?

Okay, let's pretend we have such strictness.
  typedef int foo_t;
  typedef int bar_t;
  foo_t f1, f2;
  bar_t b1;
  int   i;

Now, which of the following expressions should be legal, and what should be
their types?
  -f1         f1 + 1      f1 - f2     f1 * 5      f1 / f2
  f1 + b1     f1 * b1     f1 = i      i = f1      f1 = b1

I'm not saying that dimensional analysis shouldn't be done, just that it's not
trivial to define the rules.  In fact I have a partially-written essay on
this, which I might post someday...

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint



More information about the Comp.lang.c mailing list