...
The c++ is perfectly safe, because putc() guarantees to evaluate its character argument exactly once.
This example only illustrates shows the side-effect issue. The output differs depending on the character set and one should not make assumptions about the order of the letters. For example, when run on a machine using an ASCII derived code set such as ISO-8859 or Unicode, this code sample will print out the 26 lower case letters of the English alphabet. However, if run with an EBCDIC based code set such as Codepage 037 or Codepage 285, punctuation marks marks or symbols might get printed out in between the letters.
...
| Wiki Markup |
|---|
\[[ISO/IEC 9899-:1999|AA. C References#ISO/IEC 9899-1999]\] Section 7.19.7.5, "The {{getc}} function," and Section 7.19.7.8, "The {{putc}} function" |
...