12.3. Incompatibilities of GCC

12.3 Incompatibilities of GCC

There are several noteworthy incompatibilities between GNU C and K&R (non-ISO) versions of C.

  • GCC normally makes string constants read-only. If several identical-looking string constants are used, GCC stores only one copy of the string.

    One consequence is that you cannot call mktemp with a string constant argument. The function mktemp always alters the string its argument points to.

    Another consequence is that sscanf does not work on some very old systems when passed a string constant as its format control string or input. This is because sscanf incorrectly tries to write into the string constant. Likewise fscanf and scanf.