的strdup [英] strdup
问题描述
根据最近的clc ++火焰战,半无处不在但又不是ANSI
strdup()函数实际上违反了C标准,因为它是非法的
命名。如果这是真的,它违反了哪些标准命名规则?
-
Christopher Benson-Manica | Jumonji giri,荣誉。
ataru(at)cyberspace.org |
According to a recent c.l.c++ flame war, the semi-ubiquitous-but-not-ANSI
strdup() function actually violates the C standard, because it is illegally
named. If this is true, what standard naming rule(s) does it violate?
--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cyberspace.org |
推荐答案
" Christopher Benson-Manica" <在*** @ nospam.cyberspace.org>在消息中写道
新闻:bk ********** @ chessie.cirr.com ...
"Christopher Benson-Manica" <at***@nospam.cyberspace.org> wrote in message
news:bk**********@chessie.cirr.com...
根据最近的clc ++火焰战,
我不会称之为火焰战争,但是有些人不同意,而且有些人在学习。 :-)
半无处不在但ANSI
strdup()函数实际上违反了C标准,因为它是非法命名的
。
是的,它违反了保留的名称约束。
如果这是真的,它违反了哪些标准命名规则?
According to a recent c.l.c++ flame war,
I wouldn''t call that a ''flame war'', but a few folks
disagreeing, and some learning. :-)
the semi-ubiquitous-but-not-ANSI
strdup() function actually violates the C standard, because it is illegally named.
Yes, it violates a reserved name constraint.
If this is true, what standard naming rule(s) does it violate?
< begin quote>
ISO / IEC 9899:1999(E)
[ ...]
7.26未来的图书馆方向
1以下名称分组在各个标题下
for方便。下面描述的所有外部名称都是
保留,无论程序包含哪些标题。
[...]
7.26.11字符串处理< string.h>
1以str,mem或wcs开头的函数名和小写字母
字母可以添加到< string.h>中的声明中。标题。
< end quote>
这对我来说意味着''str'''''mem'' ,
和''wcs''是允许的。有人在乎确认或否认吗?
-Mike
-Mike
<begin quote>
ISO/IEC 9899:1999 (E)
[...]
7.26 Future library directions
1 The following names are grouped under individual headers
for convenience. All external names described below are
reserved no matter what headers are included by the program.
[...]
7.26.11 String handling <string.h>
1 Function names that begin with str, mem,or wcs and a lowercase
letter may be added to the declarations in the <string.h> header.
<end quote>
This does imply to me that the identifers ''str'', ''mem'',
and ''wcs'' are allowed. Anyone care to confirm or deny?
-Mike
-Mike
Mike Wahler< mk ****** @ mkwahler.net>这样说:
Mike Wahler <mk******@mkwahler.net> spoke thus:
我不会称之为火焰战争,但有些人不同意,有些学习。 :-)
有些人学习比其他更多;)
1以str,mem或wcs开头的函数名和小写的
字母可以添加到< string.h>中的声明中;标题。
I wouldn''t call that a ''flame war'', but a few folks
disagreeing, and some learning. :-)
Some people "learning" more than others ;)
1 Function names that begin with str, mem,or wcs and a lowercase
letter may be added to the declarations in the <string.h> header.
所以,从本质上讲,这就是说标准可能会选择
指定一个标准的strdup()函数?想想看,因为strdup()是广泛使用的b $ b,为什么它不是标准的?它不是特定于实现的(例如,
,htonl等)...
-
Christopher Benson-Manica | Jumonji giri,荣誉。
ataru(at)cyberspace.org |
So, in essence, this is saying that at some point the Standard may choose to
specify a standard strdup() function? Come to think of it, since strdup() is
widely used, why isn''t it standard? It isn''t implementation-specific (like,
say, htonl and such)...
--
Christopher Benson-Manica | Jumonji giri, for honour.
ataru(at)cyberspace.org |
文章< bk ******** **@chessie.cirr.com> ;, Christopher Benson-Manica写道:
In article <bk**********@chessie.cirr.com>, Christopher Benson-Manica wrote:
根据最近的clc ++火焰战,半无处不在但不是ANSI
strdup()功能实际上违反了C标准,因为它是非法命名的。如果这是真的,它违反了哪些标准命名规则?
According to a recent c.l.c++ flame war, the semi-ubiquitous-but-not-ANSI
strdup() function actually violates the C standard, because it is illegally
named. If this is true, what standard naming rule(s) does it violate?
C99标准的第7.26.10和7.26.11节说明在
未来,以str开头的函数可能会被添加到
< stdlib.h>和< string.h>标题。
7.26的基本原理以用户被告知失败
来注意这里提到的点数被认为是
对于符合规定的计划不合适。
-
Andreas K?h?ri
Sections 7.26.10 and 7.26.11 of the C99 standard says that in
the future, functions that begin with "str" might be added to
the <stdlib.h> and <string.h> headers.
The rationale for 7.26 ends with "Users are advised that failure
to take heed of the points mentioned herein is considered
undesirable for a conforming program".
--
Andreas K?h?ri
这篇关于的strdup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!