enums

Karl Heuer karl at haddock.ISC.COM
Tue Aug 2 03:32:15 AEST 1988


In <2404 at boulder.Colorado.EDU> swarbric at tramp (Frank Swarbrick) writes:
>In <11686 at steinmetz.ge.com> davidsen at crdos1.UUCP (bill davidsen) writes:
>>[enums should be in sequence, so ++ and -- can be used meaningfully]
>
>Personally, I would like it to be even a little more like Pascal.  [++ on the
>last item should wrap to the first.]  This is like Pascal's succ() and pred()

I rather doubt that this is true of Pascal -- I've never heard of it before --
but I don't claim to be a Pascal expert, and anyway it doesn't affect my
reply.  I *don't* think it should be true of C, because it violates the
principle of keeping the primitives simple.  Most applications don't need the
wraparound behavior, and it does have a nontrivial cost, therefore the ++
operator should simply step by one (with undefined behavior if you step off
the end).

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