strncpy_s和gcc? [英] strncpy_s and gcc ?
问题描述
我一直在做一些(重新)搜索VS警告
警告C4996:''strncpy''被宣布弃用
似乎成为一种强制strncpy被弃用的MS方式,但它没有被ISO弃用。
然而MS希望用strncpy_s替换它
1)是c ++,TR1还是只是MS标准(TR提案)?
2)gcc 4.1.1似乎没有strncpy_s - 是这是正确的
(或者我错过了包含什么)
I have been doing some (re)search on the VS-warning
warning C4996: ''strncpy'' was declared deprecated
It seems to be a MS-way to force strncpy to become deprecated, but it
is not ISO-deprecated.
However MS wants this to be replaced with strncpy_s
1) Is it c++,TR1 or just MS standard (TR proposal) ?
2) gcc 4.1.1 does not seem to have strncpy_s - is that correct
(Or do I miss an include or something)
推荐答案
tmartsum写道:
tmartsum wrote:
我一直在做一些(重新)搜索VS警告
警告C4996:''strncpy ''被宣布弃用
似乎是一种强制strncpy被弃用的MS方式,但是它没有被ISO弃用。
然而MS希望将其替换为strncpy_s
1)是c ++,TR1还是只是MS标准(TR提案)?
2)gcc 4.1.1似乎没有strncpy_s - 是正确的
(或者我错过了包括或者什么)
I have been doing some (re)search on the VS-warning
warning C4996: ''strncpy'' was declared deprecated
It seems to be a MS-way to force strncpy to become deprecated, but it
is not ISO-deprecated.
However MS wants this to be replaced with strncpy_s
1) Is it c++,TR1 or just MS standard (TR proposal) ?
2) gcc 4.1.1 does not seem to have strncpy_s - is that correct
(Or do I miss an include or something)
坦率地说,没有人关心MS的想法。复制对象,如字符串,
应该由复制构造函数句点处理。当你听到MS说
这个单词string时,这可能意味着很多不同的东西。
#include< string>
int main()
{
std :: string s(短字符串);
std :: string copy(s); //那就是你复制字符串的方式 - 复制ctor
- 简单定义
}
Frankly, no-one cares what MS thinks. Copying an object, like a string,
should be handled by a copy constructor, period. When you hear MS say
the word "string", that can mean a lot of different things.
#include <string>
int main()
{
std::string s("a short string");
std::string copy(s); // and that''s how you copy a string - copy ctor
- simplicity defined
}
>
Salt_Peter skrev:
Salt_Peter skrev:
tmartsum写道:
tmartsum wrote:
我一直在做一些(重新)搜索VS警告
警告C4996:''strncpy''被宣布弃用
它似乎是一个MS方式强制strncpy被弃用,但是它没有被ISO弃用。
但是MS希望用strncpy_s替换它
1)是c ++,TR1还是只是MS标准(TR提案)?
2)gcc 4.1.1似乎没有strncpy_s - 是正确的
(或者我想念一个包含什么)
I have been doing some (re)search on the VS-warning
warning C4996: ''strncpy'' was declared deprecated
It seems to be a MS-way to force strncpy to become deprecated, but it
is not ISO-deprecated.
However MS wants this to be replaced with strncpy_s
1) Is it c++,TR1 or just MS standard (TR proposal) ?
2) gcc 4.1.1 does not seem to have strncpy_s - is that correct
(Or do I miss an include or something)
坦率地说,没有人关心MS的想法。复制对象,如字符串,
应该由复制构造函数句点处理。当你听到MS说
这个单词string时,这可能意味着很多不同的东西。
#include< string>
int main()
{
std :: string s(短字符串);
std :: string copy(s); //这就是你复制字符串的方式 - 复制ctor
- 简单定义
}
Frankly, no-one cares what MS thinks. Copying an object, like a string,
should be handled by a copy constructor, period. When you hear MS say
the word "string", that can mean a lot of different things.
#include <string>
int main()
{
std::string s("a short string");
std::string copy(s); // and that''s how you copy a string - copy ctor
- simplicity defined
}
你是对的 - 这是应该的方式,但不幸的是它确实没有回答关于strncpy_s状态的问题。
情况就是这样我有很多旧的char * -strings旧代码。
现在当我编译VS时说了些什么而gcc说了别的东西。
什么是关于它的真相?
所以问题仍然存在......
(但感谢您的意见)
You are right - this is the way it should be, but unfortunately it does
not answer my question on status on strncpy_s.
The situation is that I have a lot of old code with old char*-strings.
Now when I compile VS says something and gcc says something else.
What is the truth about it ?
So the question remains ....
(But thanks for your input)
>
tmartsum写道:
tmartsum wrote:
我一直在做一些(重新)搜索VS警告
警告C4996:'' strncpy''被声明已弃用
似乎是强制strncpy被弃用的MS方式,但它不是ISO弃用的。 br />
然而,MS希望将其替换为strncpy_s
1)是c ++,TR1还是只是MS标准(TR提案)?
I have been doing some (re)search on the VS-warning
warning C4996: ''strncpy'' was declared deprecated
It seems to be a MS-way to force strncpy to become deprecated, but it
is not ISO-deprecated.
However MS wants this to be replaced with strncpy_s
1) Is it c++,TR1 or just MS standard (TR proposal) ?
当前标准中没有strncpy_s。我也没有在
TR1草案中找到它。
There is no strncpy_s in the current standard. I also didn''t find it in the
TR1 draft.
2)gcc 4.1.1似乎没有strncpy_s - 这是正确的
(或者我错过了包含什么)
2) gcc 4.1.1 does not seem to have strncpy_s - is that correct
(Or do I miss an include or something)
gcc邮件列表是这个问题的好地方。
最佳
Kai-Uwe Bux
The gcc mailing lists would be a good place for this question.
Best
Kai-Uwe Bux
这篇关于strncpy_s和gcc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!