"using the result of a comma expression is not allowed"

Don Allen donaldcallen at gmail.com
Sun Apr 21 16:28:47 UTC 2024


I just ran across "using the result of a comma expression is not 
allowed" in a situation where I used a comma expression as I 
would in C, expecting its value to be the value of the right-most 
expression.

While D's language document is accurate in explaining how the 
comma expression is treated in D in 11.5, that treatment 
conflicts with 11.1:
"Expressions are used to compute values with a resulting type. 
These values can then be assigned, tested, or ignored. 
Expressions can also have side effects."

This restriction makes no sense to me, nor does calling this an 
"expression" if you can't use its value.


More information about the Digitalmars-d mailing list