Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!tymix!cirrusl!ss168!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: comp.lang.c Subject: Re: Terminology Keywords: expression definition Message-ID: <3055@cirrusl.UUCP> Date: 15 Apr 91 22:05:44 GMT References: <1917@manta.NOSC.MIL> Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 30 In <1917@manta.NOSC.MIL> mitch@manta.NOSC.MIL (Ray Mitchell) tries to define an "expression": "Any combination of constants, variables, and operators (producing a value)" It seems intuitively clear that an expression must have a value... However, how about a function returning "void" or an expression cast to type "void"? In colloquial technical English, an expression is any entity that has a value. Therefore a function returning "void" is not an expression. The purpose of introducing such functions into C was to belatedly add procedures to the language. Languages that have procedures don't need void-returning functions. But when you define a programming language, the concept of "expression" as described above is not necessary. Languages that use the term "expression" use it only as a syntactic token to which some meaning must be separately assigned. Instead of saying "expression" you can say "gadget" or "whatist" without losing any information. So, if the grammar of a language (e.g. C) allows an "expression" to be, among other things, a function returning void, it's purely for notational convenience. In other words, "expression" means whatever you want it to mean. A function returning void is not an expression--unless you say so. -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi