[TUHS] v7 K&R C

Larry McVoy lm at mcvoy.com
Mon May 11 10:57:46 AEST 2020


My mail is screwed up, I see Rob's reply to Steve but didn't see Steve's
original.

> On Mon, May 11, 2020 at 10:28 AM <scj at yaccman.com> wrote:
> > With respect to enums, there is a feature I've wanted for years: a typed
> > typedef.  Saying typetdef int foo would make foo an integer, but if you
> > passed an ordinary int to something declared as foo it would be an error.
> > Even if it was an integer constant unless cast.

Steve, I couldn't agree more, you are 100% right, this is how it should
work.  I wanted to like enums because I naively thought they'd have these
semantics but then learned they really aren't any different than a well
managed list of #defines.

IMHO, without your semantics, enums are pretty useless, #define is good
enough and more clear.

--lm


More information about the TUHS mailing list