问题
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