Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Readability part I - code Date: Wed, 06 May 2015 13:11:56 -0700 Organization: None to speak of Lines: 37 Message-ID: <87egmtlb3n.fsf@kst-u.example.com> References: <87twvpaihi.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="9be37d943435275679235b07c7947eef"; logging-data="15492"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bXW7BSnqqCkfukvXI1XC2" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:yEHETDYBxArIzKiYLZKJfS+/OWE= sha1:xjN2IUxf56vAx1KyvPPUjNhrbio= Xref: csiph.com comp.lang.c:61642 David Kleinecke writes: > On Wednesday, May 6, 2015 at 7:28:05 AM UTC-7, Ben Bacarisse wrote: >> > I don't really understand myself. C only has a handful of keywords, >> >> You have large hands. I count 44. It's still 33 even if you reject all >> the new ones. > > If you look at each word, symbol and symbol combination as a token (outside > of strings) then C90 has 78 built in tokens. A compiler should have a > tokenizer at its front end so all it sees is tokens. Sizeof is just > another token at the same level as, say, &. C90 has 32 keywords, C99 has 37, and C11 has 44. I'm not sure what relevance those numbers have. Malcolm's claim upthread that the `sizeof` keyword "is effectively a function" is incorrect. It's an operator. It happens to be the only operator whose name is a keyword rather than a symbol. If you use other languages that have more operators like that, you'll get used to it. For example, several languages use `rem` and/or `mod` in place of C's `%`. Similarly, you might think of `return` as a function if you habitually parenthesize the expression. That's one reason I avoid doing that. (A digression: The form of `sizeof` that applies to a parenthesized type name isn't something I'd call an operator, since its "operand" isn't a expression. I'd call it a special form of expression, disinct from the `sizeof expr` form. But the standard calls it a unary operator in both forms, so I'll go along with it.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"