关于strcpy()的设计考虑 [英] about design consideration of strcpy()

查看:64
本文介绍了关于strcpy()的设计考虑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

strcpy()返回它的输入参数。我在

c ++上问了一个类似的问题,大多数人似乎并不认为这是一个有问题的设计。你怎么想?b $ b想到这个?

http://groups.google.com/group/comp....0aa4307b91bad8

strcpy() returns it''s input parameter. i asked a similar question on
c++, most people seem to not think it as a problemic design. how do you
think of this?

http://groups.google.com/group/comp....0aa4307b91bad8

推荐答案

>大多数人似乎并不认为这是一个有问题的设计。


抱歉。它应该是:

大多数人似乎认为这是一个有问题的设计。

> most people seem to not think it as a problemic design.

sorry. it should be:
most people seem to think it as a problemic design.


2006-05-25,史蒂夫yee< yi ****** @ gmail.com>写道:
On 2006-05-25, steve yee <yi******@gmail.com> wrote:
大多数人似乎并不认为这是一个有问题的设计。
most people seem to not think it as a problemic design.


抱歉。它应该是:
大多数人似乎认为它是一个有问题的设计。



sorry. it should be:
most people seem to think it as a problemic design.




我无法想象C ++人们对C的了解。绝对是

strcpy'的设计没什么不错。


-

Andrew Poelstra< http://www.wpsoftware.net/blog >

给我发电子邮件,请使用apoelstra。在上面的地址。

就像从宝宝那里偷牙一样。



I can''t imagine what the C++ folks know about C. There is absolutely
nothing wrong with strcpy''s design.

--
Andrew Poelstra < http://www.wpsoftware.net/blog >
To email me, use "apoelstra" at the above address.
It''s just like stealing teeth from a baby.


Andrew Poelstraaécrit:
Andrew Poelstra a écrit :
2006-05-25,steve yee< yi ****** @ gmail.com>写道:
On 2006-05-25, steve yee <yi******@gmail.com> wrote:
大多数人似乎并不认为这是一个有问题的设计。
most people seem to not think it as a problemic design.


抱歉。它应该是:
大多数人似乎认为这是一个有问题的设计。



sorry. it should be:
most people seem to think it as a problemic design.



我无法想象C ++人们对C的了解。绝对是/> strcpy'的设计没有错。


I can''t imagine what the C++ folks know about C. There is absolutely
nothing wrong with strcpy''s design.




设计中的一切都错了:


1)没有规定对于字符串的边界。 strcpy是最常见的
经常被发现的缓冲区溢出和内存覆盖的罪魁祸首。

2)返回值没有提供错误报告。这是

在大多数情况下设计不好。

3)返回值没有返回有用的信息。



Everything is wrong in that design:

1) No provision for bounds of the character strings. strcpy is the most
often found culprit of buffer overflows and memory overwrites.
2) The return value makes no provision for error reporting. This is
in most cases a bad design.
3) The return value returns no useful information.


这篇关于关于strcpy()的设计考虑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆