12.3. Incompatibilities of GCC
12.3 Incompatibilities of GCC
- 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 functionmktemp
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 becausesscanf
incorrectly tries to write into the string constant. Likewisefscanf
andscanf
.