4 ms·
But this is not particularly good imperative style. You want that to be line-based when expressions have side effects. ("one thing after another"): auto key
by msorvig 10y ago
But this is not particularly good imperative style. You want that to be line-based when expressions have side effects. ("one thing after another"):
auto key = binaryObject.getNextToken();
auto value = binaryObject.getNextToken();
print("The value of: ", key, " is ", value, "\n");
Of course if you are calling pure functions you can use nested expressions. And then the order of evaluation does not matter.
- willtim 10y agoI believe the issue is that C++ does not track what are, and are not pure functions, so the ordering optimisation is, in general, unsafe.
- byuu 10y ago> You want that to be line-based when expressions have side effects. No, I really don't. I don't want three lines instead of one line of code. And I don't want two named variables leaking into my scope. (I could encapsulate the block with {} here, but if print returned a value that I wanted to capture, then I couldn't do that.)