如果传递给它的一个或两个参数为NULL,strcmp应该返回什么? [英] What is strcmp supposed to return if one or both arguments passed to it are NULL ?

查看:69
本文介绍了如果传递给它的一个或两个参数为NULL,strcmp应该返回什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果传递给它的一个或两个参数

为空,strcmp应该返回什么?

What is strcmp supposed to return if one or both arguments passed to it
are NULL ?

推荐答案

sp****@gmail.com 说:

如果传递给它的一个或两个参数,strcmp应该返回什么

是NULL?
What is strcmp supposed to return if one or both arguments passed to it
are NULL ?



恶魔。


仔细检查你的手帕。


- -

Richard Heathfield

Usenet是一个奇怪的地方 - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)

A demon.

Inspect your handkerchief - carefully.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


sp **** @ gmail.com 写道:
sp****@gmail.com wrote:

如果一个或两个,strcmp应该返回什么传递给它的参数

是NULL吗?
What is strcmp supposed to return if one or both arguments passed to it
are NULL ?



不是。


如果strcmp的任一参数为null,则行为未定义。


因此它可能会返回-1,或1,或0,或17或1829.它可能会产生一些

类信号。它可以退出,增加任意内存,或者随机调用一些函数来调用

。任何事情:C标准放置

如果任一参数为null,则对strcmp没有限制;没有

假设。


通常,行为受到其他标准的约束,并且遵循和执行了
机制通过你的实施,所以你会更好地希望/他们/正在为你工作。


你愿意打赌吗?


-

克里斯一次只有一个鼻孔 Dollin

我还在这里,我正在拿着答案 - Karnataka,/ Love and Affection /

It isn''t.

If either argument to strcmp is null, the behaviour is undefined.

So it may return -1, or 1, or 0, or 17, or 1829. It may generate some
kind of signal. It may exit, increment arbitrary memory, or call
some random one of your functions. Anything: the C standard places
no restrictions on strcmp if either argument is null; there is no
"supposed".

Typically, the behaviour is constrained by other standards and
mechanisms obeyed and performed by your implementation, so you''d
better hope that /they/ are working for you.

Are you willing to bet your nose on it?

--
Chris "one nostril at a time" Dollin
"I''m still here and I''m holding the answers" - Karnataka, /Love and Affection/


sp **** @ gmail.com 写道:

如果传递给它的一个或两个参数,strcmp应返回什么

为NULL ?
What is strcmp supposed to return if one or both arguments passed to it
are NULL ?



它可能无法完成并且在中途崩溃,因此没有返回

返回。


lovecreatesbeauty

It may not be completed and crash midway, thereby having nothing
returned.

lovecreatesbeauty


这篇关于如果传递给它的一个或两个参数为NULL,strcmp应该返回什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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