What is the difference between -std=c++0x and -std=c++11

前端 未结 2 606
感情败类
感情败类 2021-01-01 20:13

I know those flags are for C++11 in Eclipse.

But I don\'t know what is difference and which one is more preferred.

It seems that they both are working with C

2条回答
  •  余生分开走
    2021-01-01 20:59

    You should prefer -std=c++11.

    (Note: I assume -std=c++11x is a typo in your question)

    The old -std=c++0x is only needed for older compiler versions that did not support -std=c++11 and they chose that name to express the preliminary and unstable nature of features (and the ABI) of the then upcoming C++11 (and when it was still unclear whether that would eventually become C++10 or C++12). They changes some of the details adapting to the changing working drafts of the standard at the time before the C++11 standard was officially released.

    If your compiler supports -std=c++11, there is no reason to use -std=c++0x. Concerning compatibility: There might even be differences and incompatibilities, but these are not just bound to the use of -std=c++0x, but to specific versions of the compiler. When the compiler supports both, they should be identical.

提交回复
热议问题