Jump to content

Talk:Expression (computer science)

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Void expressions

[edit]

It is reported for the C language that a syntactically correct function call is an expression too unless the function has void return type.

This is incorrect (the citation is a 404 page anyway). In C, and I assume most C-derived languages, a syntactically-correct function call to a function with void return type is a valid expression. The expression has type "void" and evaluates to a valid value, "the void value", and there are special limitations on what you can do with a value of type "void" -- basically you can cast it to void, and just about everything else is disallowed. But it is a valid expression and a valid value. See ISO/IEC 9899:1999 section 6.3.2.2 (void). Hence I am changing the article. --EatMyShortz (talk) 11:47, 31 August 2009 (UTC)[reply]

The way an expression is defined here means basically nothing...

[edit]

Seriously, it makes no sense at all. — Preceding unsigned comment added by Bumblebritches57 (talkcontribs) 17:45, 19 February 2014 (UTC)[reply]

TODO

[edit]

The article treats an important basic concept of programming languages, yet it is rather superfluous. A number of improvements suggested:  

  • add more alternative definitions (in particular, IEEE dictionary defines statement as a kind of expression) with citations
  • more explicitly describe contrast of expression with statement with examples (expressions can be nested - statements cannot)
  • give an example of the syntactical units that can be statements or expressions (= vs := in Python for assignment statement and assignment expression)
  • provide a BNF/EBNF example of an expression/expression nesting — Preceding unsigned comment added by P.maistrenko (talkcontribs) 16:56, 12 April 2020 (UTC)[reply]