定义行为还是其他? [英] Defined bahavior or otherwise?

查看:96
本文介绍了定义行为还是其他?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果以下构造定义了行为
标准中的



v + = v + x;


(假设所有变量都是

相同的类型。)


我知道我期望的构造

要做,但预计不一定是

定义。


-

"它是不可能做任何万无一失的事情

因为傻瓜太聪明了

- A. Bloch

解决方案

< blockquote> 2004年4月8日星期四00:55:35 GMT,Nick Landsberg< hu ***** @ NOSPAM.att.net>

写道:


如果以下构造在标准中定义了行为?

v + = v + x;


由于评估中允许的变化,结果不会发生变化

序列点之间的顺序(这里似乎没有任何顺序),

你应该全部设定。
(假设所有变量都是相同的类型。)


我不是如果他们不是,那肯定会有所不同。

-leor
我知道我希望这个结构能做什么,但预计不一定是
定义。




-

Leor Zolman --- BD软件--- www.bdsoft.com

C / C ++,Java,Perl和Unix的现场培训

C ++用户:下载BD Software的免费STL错误消息解密器:
www.bdsoft.com/tools/stlfilt.html


Leor Zolman写道:

2004年4月8日星期四00:55:35 GMT,Nick Landsberg< hu ***** @ NOSPAM.att.net>
写道:

如果以下构造在标准中定义了行为?

v + = v + x;



由于结果不能因评估中允许的变化顺序点之间的顺序(这里似乎没有任何顺序),
你应该全部设置。

(假设所有变量都是相同的类型。)



我不确定它们会不会有任何区别,如果它们不是。
-leor

我知道我期望构造
做什么,但预期不一定定义。




谢谢,Leor :)

-

不可能做任何万无一失的

因为傻瓜是如此巧妙

- A. Bloch


Leor Zolman< le ** @ bdsoft.com>这样说:

我不确定如果他们不是会有任何不同。




嗯,如果其中一个是未签名的短片,另一个不是,那么

差异很可能随之而来:)


-

Christopher Benson-Manica |我*应该*知道我在说什么 - 如果我

ataru(at)cyberspace.org |不,我需要知道。火焰欢迎。



If the following construct defined behaviour
in the standard?

v += v + x;

(Assuming all variables are of the
same type.)

I know what I would expect the construct
to do, but expected is not necessarily
defined.

--
"It is impossible to make anything foolproof
because fools are so ingenious"
- A. Bloch

解决方案

On Thu, 08 Apr 2004 00:55:35 GMT, Nick Landsberg <hu*****@NOSPAM.att.net>
wrote:


If the following construct defined behaviour
in the standard?

v += v + x;
Since the result cannot vary due to permissible variations in evaluation
order between sequence points (of which there don''t seem to be any here),
you should be all set.
(Assuming all variables are of the
same type.)
I''m not sure it would make any difference if they weren''t.
-leor
I know what I would expect the construct
to do, but expected is not necessarily
defined.



--
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix
C++ users: Download BD Software''s free STL Error Message Decryptor at:
www.bdsoft.com/tools/stlfilt.html


Leor Zolman wrote:

On Thu, 08 Apr 2004 00:55:35 GMT, Nick Landsberg <hu*****@NOSPAM.att.net>
wrote:

If the following construct defined behaviour
in the standard?

v += v + x;


Since the result cannot vary due to permissible variations in evaluation
order between sequence points (of which there don''t seem to be any here),
you should be all set.

(Assuming all variables are of the
same type.)


I''m not sure it would make any difference if they weren''t.
-leor

I know what I would expect the construct
to do, but expected is not necessarily
defined.



Thanks, Leor :)
--
"It is impossible to make anything foolproof
because fools are so ingenious"
- A. Bloch


Leor Zolman <le**@bdsoft.com> spoke thus:

I''m not sure it would make any difference if they weren''t.



Well, if one of them is an unsigned short, and the other isn''t, then
differences are likely to ensue :)

--
Christopher Benson-Manica | I *should* know what I''m talking about - if I
ataru(at)cyberspace.org | don''t, I need to know. Flames welcome.


这篇关于定义行为还是其他?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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