call()和return() [英] call() and return()

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

问题描述

我刚刚阅读了D& E的§2.11.3,我不得不说,我对它所说的内容感到非常困惑。

http://java.sun.com/docs/书籍/导师... y / syncrgb.html

< shrug>

-

NOUN:1。遗嘱遗留给他人的金钱或财产。 2.从祖先或前任或过去那里下来的东西:b
宗教自由的遗产。 ETYMOLOGY:MidE legacie,副手办公室,来自OF,来自ML legatia的
,来自L legare,以及deute,遗赠。 www.bartleby.com/61/

解决方案

* Steven T. Hatton:


我刚刚阅读了D& E的§2.11.3,我必须比如说,我很尴尬地说它是什么。

http://java.sun.com/docs/books/tutor...y/syncrgb.html

< shrug>



小心发布一些可以理解的内容/来自

发布的内容/?


-

答:因为它弄乱了人们通常阅读文字的顺序。

问:为什么这么糟糕?

A:热门发布。

问:usenet和电子邮件中最烦人的事情是什么?


< blockquote>" Steven T. Hatton" < ch ******** @ germania.supwrote in message

news:ZZ ********************** ********@speakeasy.ne t ...


>我刚看了D& E的§2.11.3,我必须比如说,我很尴尬地说它是什么。

http://java.sun.com/docs/books/tutor...y/syncrgb.html

< shrug>

-

NOUN:1。遗嘱遗留给他人的金钱或财产。 2.从祖先或前任或过去那里下来的东西:b $ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ETYMOLOGY:MidE legacie,副手办公室,来自OF,来自ML legatia的
,来自L legare,以及deute,遗赠。 www.bartleby.com/61/



你给出的链接是谈论一些同步的颜色类。我没有/ b $ b看到call()和/或return()在任何地方。


你的帖子很混乱。想再试一次吗?


Alf P. Steinbach写道:


* Steven T. Hatton:


>我刚刚阅读了D& E的§2.11.3,我不得不说,我对它所说的内容感到非常困惑。 />

http://java.sun.com/docs/books/tutor...y/syncrgb.html


><耸肩>



小心发布一些可以理解的内容/来自

发布的文字/?



< quote url =" http://www.gotw.ca/publications/c_family_interview.htm">

问:你有没有添加功能您的用户并不像您所做的那样感激多少,然后不得不弃用或删除它们?你是怎么回事?b $ b从这次经历中学到了什么?


Ritchie:我在用户的压力下添加了一些东西,我不会这样做b $ b认为做得很好。枚举类型有点奇怪,位域更奇怪。

静态关键字非常奇怪,表达了存储生命周期

以及标准调用的链接和(外部可见性)。这里和那里有很多

奇数位。


我记不起我添加的功能我必须删除除了一些小的

位,就像条目一样。关键字。


Stroustrup:当我用Classes和C ++设计C时,我非常热衷于

的想法,即一个类定义了代码所在的环境其成员

功能运作(我还是)。这导致构造函数的概念

建立该环境(不变)并获得所需的资源。

析构函数反转该过程(释放资源)。这些想法是异常和资源管理设计的根源。例如,

请参阅新的附录E:标准库例外安全 C ++

编程语言。[3]那个附录可以从我的家里下载

页面。[4]


基于这种思路,C with Classes也允许你定义一个

在进入成员函数之前调用的call()函数和从成员函数退出后调用的
return()函数。

call()/ return()机制旨在允许程序员管理单个成员函数调用所需的
资源。这允许

我为第一个任务库实现监视器。一个任务的调用()

抓住一个锁,其匹配的return()释放了锁。想法来自

部分来自Lisp''s:之前和之后的方法。但是,这个概念并不是完全通用的 - 例如,你无法通过call()访问

成员函数调用的参数。更糟糕的是,我完全没有说服

这个概念有用的人,所以我在定义C ++时删除了call()并返回()



< / quote>


最后一句话让我感到困惑。

-

NOUN: 1。遗嘱遗留给他人的金钱或财产。 2.从祖先或前任或过去那里下来的东西:b
宗教自由的遗产。 ETYMOLOGY:MidE legacie,副手办公室,来自OF,来自ML legatia的
,来自L legare,以及deute,遗赠。 www.bartleby.com/61/


I just read §2.11.3 of D&E, and I have to say, I''m quite puzzled by what it
says.

http://java.sun.com/docs/books/tutor...y/syncrgb.html
<shrug>
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/

解决方案

* Steven T. Hatton:

I just read §2.11.3 of D&E, and I have to say, I''m quite puzzled by what it
says.

http://java.sun.com/docs/books/tutor...y/syncrgb.html
<shrug>

Care to post something that''s possible to understand /from the text in
the posting/?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


"Steven T. Hatton" <ch********@germania.supwrote in message
news:ZZ******************************@speakeasy.ne t...

>I just read §2.11.3 of D&E, and I have to say, I''m quite puzzled by what it
says.

http://java.sun.com/docs/books/tutor...y/syncrgb.html
<shrug>
--
NOUN:1. Money or property bequeathed to another by will. 2. Something
handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/

The link you gave is talking about some syncronized color class. I don''t
see call() and/or return() in it anywhere.

Your post is confused. Wanna try again?


Alf P. Steinbach wrote:

* Steven T. Hatton:

>I just read §2.11.3 of D&E, and I have to say, I''m quite puzzled by what
it says.

http://java.sun.com/docs/books/tutor...y/syncrgb.html

><shrug>


Care to post something that''s possible to understand /from the text in
the posting/?

<quote url="http://www.gotw.ca/publications/c_family_interview.htm">
Q: Did you ever add features that your users didn''t appreciate as much as
you did, and then have to deprecate or remove them later? What did you
learn from the experience?

Ritchie: I added some things under some pressure from users that I don''t
think were done well. Enumeration types are a bit odd, bitfields are odder.
The "static" keyword is very strange, expressing both a storage lifetime
and what the standard calls "linkage" (external visibility). There are many
odd bits here and there.

I can''t remember features I added that I had to remove except for some tiny
bits, like the "entry" keyword.

Stroustrup: When I designed C with Classes and C++, I was very keen on the
idea that a class defined the environment in which the code of its member
functions operate (I still am). This led to the notion of constructors that
establish that environment (invariant) and acquire the resources needed.
Destructors reverse that process (releasing resources). These ideas are at
the root of the design of exceptions and resource management. For example,
see the new Appendix E: "Standard-Library Exception Safety" of The C++
Programming Language.[3] That appendix can be downloaded from my home
pages.[4]

Based on that line of thinking, C with Classes also allowed you to define a
call() function that was called before entry into a member function and a
return() function that was called after exit from a member function. The
call()/return() mechanism was meant to allow a programmer to manage
resources needed for an individual member function invocation. This allowed
me to implement monitors for the first task library. A task''s call()
grabbed a lock and its matching return() released the lock. The idea came
partly from Lisp''s :before and :after methods. However, the notion wasn''t
perfectly general -- for example, you couldn''t access arguments for a
member function call from call(). Worse, I completely failed to convince
people of the usefulness of this notion, so I removed call() and return()
when I defined C++.
</quote>

The last sentence is what has me baffled.
--
NOUN:1. Money or property bequeathed to another by will. 2. Something handed
down from an ancestor or a predecessor or from the past: a legacy of
religious freedom. ETYMOLOGY: MidE legacie, office of a deputy, from OF,
from ML legatia, from L legare, to depute, bequeath. www.bartleby.com/61/


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

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