Storgae持续时间 [英] Storgae durations

查看:141
本文介绍了Storgae持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C中的树存储空间(静态,自动和动态)有什么区别?

what is the difference between the tree storage
durations(static,automatic and dynamic) in C?

推荐答案

jr******@gmail.com 说:

C存储区中的树存储空间(静态,自动和动态)有什么区别?
what is the difference between the tree storage
durations(static,automatic and dynamic) in C?



首先,只有两个:


++++++++++++++++++ ++++++++++++++++++++++++++++++++++


对象的存储持续时间决定了它的生命周期。

有两个存储持续时间:静态和自动。

+ +++++++++++++++++++++++++++++++++++++++++++++++++


那么,它们之间的区别是什么?


+++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++或者使用

存储类说明符static具有静态存储持续时间。对于这样的对象,存储是保留的,并且在程序启动之前,它的存储值仅被初始化

一次。该对象存在并保留

整个执行整个

程序时的最后存储值.12 /

声明没有链接且没有存储类的对象

说明符static具有自动存储持续时间。保证存储

保留给这个对象的新实例,每个正常的

条目进入声明它的块,或从
块外的块中或封闭块中的标签。

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++ b Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

Firstly, there are only two:

++++++++++++++++++++++++++++++++++++++++++++++++++
3.1.2.4 Storage durations of objects

An object has a storage duration that determines its lifetime.
There are two storage durations: static and automatic.
++++++++++++++++++++++++++++++++++++++++++++++++++

So, what''s the difference between them?

++++++++++++++++++++++++++++++++++++++++++++++++++
An object declared with external or internal linkage, or with the
storage-class specifier static has static storage duration. For such
an object, storage is reserved and its stored value is initialized
only once, prior to program startup. The object exists and retains
its last-stored value throughout the execution of the entire
program./12/

An object declared with no linkage and without the storage-class
specifier static has automatic storage duration. Storage is guaranteed
to be reserved for a new instance of such an object on each normal
entry into the block in which it is declared, or on a jump from
outside the block to a label in the block or in an enclosed block.
++++++++++++++++++++++++++++++++++++++++++++++++++

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


Richard Heathfield< rj*@see.sig.invalidwrites:
Richard Heathfield <rj*@see.sig.invalidwrites:
jr ****** @ gmail.com 说:

> C中树存储的持续时间(静态,自动和动态)有什么区别?
>what is the difference between the tree storage
durations(static,automatic and dynamic) in C?



首先,只有两个:


Firstly, there are only two:



更正:那里_were_只有两个。

Correction: there _were_ only two.


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

有两个存储持续时间:静态和自动。
++++++++++++++++++++++++++++++++++++++++++++++++++
3.1.2.4 Storage durations of objects

An object has a storage duration that determines its lifetime.
There are two storage durations: static and automatic.



6.2.4对象的存储持续时间现在说:


对象的存储持续时间决定了它的生命周期。

是三个存储持续时间:静态,自动和

分配。分配存储在7.20.3中描述。


C90如何在malloc中只有两个?


-

Ben。

6.2.4 "Storage durations of objects" now says:

An object has a storage duration that determines its lifetime. There
are three storage durations: static, automatic, and
allocated. Allocated storage is described in 7.20.3.

How did C90 square there being only two with malloc?

--
Ben.


Ben Bacarisse说:
Ben Bacarisse said:

Richard Heathfield< rj * @ see。 sig.invalidwrites:
Richard Heathfield <rj*@see.sig.invalidwrites:

> jr ****** @ gmail.com 说:

>>树存储
持续时间(静态,自动和动态)之间有什么区别C?
>>what is the difference between the tree storage
durations(static,automatic and dynamic) in C?


首先,只有两个:


Firstly, there are only two:



更正:那里_were_只有两个。


Correction: there _were_ only two.



啊,好吧 - 再一次,我们已经在法律上和事实上陷入了困境。 (并且

是的,我接受更正。)


< snip>

Ah, okay - once more we''ve hit the limbo between de jure and de facto. (And
yes, I accept the correction.)

<snip>


C90如何与malloc只有两个?
How did C90 square there being only two with malloc?



"如果分配成功,则返回指针,因此

可以将其分配给指向任何类型对象的指针然后使用

访问分配的空间中的这样一个对象(直到空格是明确释放或重新分配的
)。


那既不是静态的也不是自动的,因此(以C90表示)它不是
存储持续时间。 :-)


-

Richard Heathfield< http://www.cpax.org.uk>

电子邮件:-http:// www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

"The pointer returned if the allocation succeeds is suitably aligned so
that it may be assigned to a pointer to any type of object and then used
to access such an object in the space allocated (until the space is
explicitly freed or reallocated)."

That''s neither static nor auto, and therefore (in C90 terms) it isn''t a
storage duration. :-)

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


这篇关于Storgae持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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