Terminology
Rahul Dhesi
dhesi%cirrusl at oliveb.ATC.olivetti.com
Tue Apr 16 08:05:44 AEST 1991
In <1917 at manta.NOSC.MIL> mitch at 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 <dhesi at cirrus.COM>
UUCP: oliveb!cirrusl!dhesi
More information about the Comp.lang.c
mailing list