Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Null pointer constant Date: Tue, 20 Jun 2017 12:39:42 -0700 Organization: None to speak of Lines: 33 Message-ID: References: <9zM1B.193976$KK7.183000@fx12.am4> <87shiwc4il.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="6d63db2e8ea996f9a358079ee566ecd1"; logging-data="7383"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+x19Rbsmxjb514JvX5K3T3" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:HTkPSyb7lTZXqy89EtIA1SLa6tk= sha1:jDMQqyHxseyhNf9AJu5DsUR+UC0= Xref: csiph.com comp.lang.c:112731 Nick Bowler writes: > On Tue, 20 Jun 2017 11:55:20 -0700, Keith Thompson wrote: > [...] >> But if we look at the definition of "expression" (6.5p1): >> >> An *expression* is a sequence of operators and operands that >> specifies computation of a value, or that designates an object >> or a function, or that generates side effects, or that performs >> a combination thereof. >> >> and take it literally, then 0 isn't even an expression; it has >> no operators, and therefore no operands. > > So there are actually two definitions of the term expression in the > standard, the other is in 6.5.17 (where it appears on the left side > of a syntax rule). By the syntax rule, 0 is as an expression. > > The italics in 6.5p1 are probably a mistake. I'm sure the italics are deliberate. It's clearly intended to be the definition of the term "expression". The problem is that it's inconsistent with the implicit definition in the grammar. And there are aspects that are not directly reflected in the grammar. For example, `(T)0` is an expression if and only if T is a type name, and the determination of whether T is a type name or not is not fully specified by the grammar. -- 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"