On 05/08/2012 10:46 AM, Don Clugston wrote:
On 07/05/12 19:06, deadalnix wrote:
Hi,
Working on D I noticed that some statement, notably assert, are
expression of type void. Why not all statement (that are not expression
already) are expression ?
assert isn't a statement. It's an expression ( same as is() ). What
makes you think it's a statement?
The main use for a void expression is so that it can be used in a comma
expression; this is why assert is an expression.
The curious thing, which may be the source of the confusion, is that
static assert() is a statement, while assert() is an expression. Maybe
static assert should also be an expression rather than a statement?
static assert is a declaration.