Is strcpy_s part of the C++ Standard? Or only part of MS Visual C++

蓝咒 提交于 2019-12-20 07:29:15

问题


Using the function strcpy in MS Visual Studio gives me an error saying I should use strcpy_s which is safer to use. Is strcpy_s part of the C++ standard? Or is it only part of Microsoft Visual C++?

Will code containing strcpy_s only compile in Visual Studio?


回答1:


strcpy_s() is an optional part of C11 (more formally called a "conditional feature". Implementations are permitted to not implement the "Bounds-checking interfaces" standardized in Annex K.

Some other conditional features of C11 include:

  • atomics
  • complex types
  • threads
  • variable length arrays (the interesting this about this is that VLAs were not optional in C99)


来源:https://stackoverflow.com/questions/36491687/is-strcpy-s-part-of-the-c-standard-or-only-part-of-ms-visual-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!