The c++ defines the expression as
"An expression is a sequence of operators and their operands, that specifies a computation. Expression evaluation may produce a result"
https://en.cppreference.com/w/cpp/language/expressions
Are there any expressions that does not produce a result ?
Sure.
Any expression that produces a result of type void. The most obvious would be evaluating a call to a function that returns void. That will (at least normally) have some side effects, but it won't produce a value as its result.
#include <iostream>
void foo() { std:cout << "foo\n"; }
int main() {
foo(); // evaluating this expression produces no result
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With