|
|
|
|
|
by kazinator
274 days ago
|
|
Not calling the function would be evidence of further derangement in the design. Such a thing has been perpetrated in C. In C, you can repeat designated initializers. like foo f = { .a = x(), .a = y() }
The order in which the expressions are called is unspecified, just like function arguments (though the order of initialization /is/ specified; it follows initialization order).The implementaton is allowed to realize that since .a is being initialized again by y(), the earlier initialization is discarded. And it is permitted not to emit a call to x(). That's just like permitting x() not to be called in x() * 0 because we know the answer is zero. Only certain operators in C short-circuit. And they do so with a strict left-to-right evaluation discipline: like 0 && b will not evaluate b, but b && 0 will evaluate b. The initializer expressions are not sequenced, yet they can be short-circuited-out in left-to-right order. Consistency? What's that ... |
|