What exactly is a ‘side-effect’ in C++?

A “side effect” is defined by the C++ standard in [intro.execution], by:

Reading an object designated by a volatile glvalue (3.10), modifying an object, calling a library I/O function, or calling a function that does any of those operations are all side effects, which are changes in the state of the execution environment.

Leave a Comment