[TUHS] v7 K&R C

Dan Cross crossd at gmail.com
Sat Apr 25 23:17:55 AEST 2020


On Fri, Apr 24, 2020 at 11:31 PM Clem Cole <clemc at ccc.com> wrote:

> Amen bro.  I always felt that they got added because pascal had something
> that C didn’t, and yet it really was not the same.  I always felt they were
> a feature that was only partly implemented and if they were not going  to
> be fully typed then just leave them out and use cpp like we had always done
> before.
>

Aww shucks; I actually kinda like enums. When creating sequentially
numbered constants, they're convenient.

That said, the typing issues I have a lot of sympathy for. For true
constants, it's a shame that `const` didn't make it in earlier, though we
have it now. Abusing enum to define constants certainly feels like, well,
abuse.

        - Dan C.


On Fri, Apr 24, 2020 at 11:05 PM Larry McVoy <lm at mcvoy.com> wrote:
>
>> I hate enums.  I thought they would be type checked and they are just
>> ints.
>> I love C but enums suck.
>>
>> On Sat, Apr 25, 2020 at 12:54:27PM +1000, Rob Pike wrote:
>> > Another debate at the time was caused by a disagreement between pcc and
>> cc
>> > regarding enums: are they a type or just a way to declare constant? I
>> > remember getting annoyed by pcc not letting me declare a constant with
>> an
>> > enum and use it as an int. I protested to scj and dmr and after some
>> to-ing
>> > and fro-ing Steve changed pcc to treat them as constants.
>> >
>> > Not sure it was the right decision, but C desperately wanted a non-macro
>> > way to define a constant. I'd probably argue the same way today. The
>> real
>> > lesson is how propinquity affects progress.
>> >
>> > -rbo
>> >
>> >
>> > On Sat, Apr 25, 2020 at 12:51 PM Rob Pike <robpike at gmail.com> wrote:
>> >
>> > > The ability to call a function pointer fp with the syntax fp() rather
>> than
>> > > (*fp)() came rather late, I think at Bjarne's suggestion or example.
>> Pretty
>> > > sure it was not in v7 C, as you observe.
>> > >
>> > > Convenient though the shorthand may be, it always bothered me as
>> > > inconsistent and misleading. (I am pretty sure I used it sometimes
>> > > regardless.)
>> > >
>> > > -rob
>> > >
>> > >
>> > > On Sat, Apr 25, 2020 at 12:48 PM Adam Thornton <athornton at gmail.com>
>> > > wrote:
>> > >
>> > >>
>> > >>
>> > >> On Apr 24, 2020, at 7:37 PM, Charles Anthony <
>> charles.unix.pro at gmail.com>
>> > >> wrote:
>> > >>
>> > >>
>> > >>
>> > >> On Fri, Apr 24, 2020 at 7:00 PM Adam Thornton <athornton at gmail.com>
>> > >> wrote:
>> > >>
>> > >>> This doesn???t like the function pointer.
>> > >>>
>> > >>
>> > >>> $ cc -c choparg.c
>> > >>> choparg.c:11: Call of non-function
>> > >>>
>> > >>> Perhaps:
>> > >>
>> > >>     (*fcn)(arg);
>> > >>
>> > >>
>> > >> We have a winner!
>> > >>
>> > >> Also, Kartik, dunno where it is on the net, but if you install a v7
>> > >> system, /usr/src/cmd/c
>> > >>
>> > >> Adam
>> > >>
>> > >>
>>
>> --
>> ---
>> Larry McVoy                  lm at mcvoy.com
>> http://www.mcvoy.com/lm
>>
> --
> Sent from a handheld expect more typos than usual
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200425/f775f54d/attachment.html>


More information about the TUHS mailing list