Difference between using #include and #include in C++

前端 未结 5 1013
深忆病人
深忆病人 2020-11-29 23:16

What is the difference between using #include and #include> in C++? Which of the two is used and why is it is used?

5条回答
  •  时光说笑
    2020-11-29 23:56

    The old standard used the #include syntax. When namespaces and templates were added to the language, the standard was changed to #include .

    This was done so that the standard library stuff could all be placed in the std namespace. Older code, which had no concept of namespaces would still work since the #include files don't use namespaces.

    New code should always use the #include format. If you use the older format, all the symbols they define will be placed in the global namespace rather than std.

提交回复
热议问题