Strings in static memory instances count

前端 未结 4 2343
无人及你
无人及你 2021-02-19 09:45

As I know compiletime C-like strings are kept in static memory as only one instance. For instance I got both true on gcc 4.6 running example below. But I wonder is

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-19 09:49

    But I wonder is it always true

    No, at least the C standard says something like "whether two identical string literals are stored in the same array is implementation-defined".

提交回复
热议问题