Storage duration(C++学习)
来源:互联网 发布:java 动态添加字段 编辑:程序博客网 时间:2024/05/21 18:52
Storage duration
Storage duration,顾名思义,存储空间本身的持续时间。它应当不小于其所包含对象的生存周期(object lifetime)。
标准原文
和 C99,C++03比,新标准增加了一个thread相关的storage duration。
- C++ 标准(C++0x 3.7)
Storage duration is the property of an object that defines the minimum potential lifetime of the storage containing the object. The storage duration is determined by the construct used to create the object and is one of the following:— static storage duration— thread storage duration— automatic storage duration— dynamic storage duration
- C 标准(C1X 6.2.4)
An object has a storage duration that determines its lifetime. There are four storage durations: static, thread, automatic, and allocated.
分类
C++ 中的表述
哪些变量拥有
static
1. 非thread、非dynamic所有的非局部变量
2. 用static声明的局部变量和类成员变量
thread
thread_local 声明的所有变量
automatic
显式声明为register或非显式声明为static或extern的块作用域变量
dynamic
程序执行中使用new表达式创建和delete表达式销毁的对象
C 中的表述
哪些变量拥有
static
1. 未使用存储类别说明符_Thread_local且具有内部或外部链接性的对象
2. 使用存储类别说明符static的对象
thread
使用 _Thread_local 声明的对象
automatic
声明为 no linkage 且没有使用存储类别说明符 static 的对象
allocated
使用 aligned_alloc, calloc, malloc, realloc 分配
Storage class specifiers
C、C++ 分类上、术语上都有所不同。
C++
存储类别说明符:
- register
- static
- thread_local
- extern
- mutable
以下被称为类型说明符(Type specifiers)
- const
- volatile
- auto
- ...
C
存储类别说明符
- typedef
- extern
- static
_Thread_local
- auto
- register
注:typedef归于此类仅是出于语法上的便利。
而以下四个称为类型限定符(Type qualifiers)
- const
- restrict
- volatile
- _Atomic
- Storage duration(C++学习)
- C++ 静态存储周期(static storage duration)
- Duration, Scope, Linkage in C
- Duration
- C语言学习笔记(十一) -内存管理 Storage
- Storage about C variables
- C Storage Classes
- JMeter学习笔记6-Duration Assertion和Size Assertion
- Web Storage 学习笔记
- Duration(时间段)
- USB Mass Storage学习笔记
- [SAE学习笔记]Storage尝鲜
- USB Mass Storage学习笔记
- web Storage之简单学习
- HDP学习--HDFS Storage(上)
- HDP学习--HDFS Storage(中)
- 【JavaScript学习】Cookie & Web Storage
- Windows Media Player控件属性及方法(c#)以duration为什么总是“0”解决方法
- C#简单游戏外挂制作(以Warcraft Ⅲ为例)
- STL中vector容器中元素为自定义类型时的效率分析
- DDTCMS --Django Dream Team Content Management System
- 用eclipse导出jar文件时加入第三方jar包的支持
- Django 处理 unicode的方法
- Storage duration(C++学习)
- C# WinForm下DataGridView单选按钮列和支持三种选择状态的复选框列的实现
- Django:DDTCMS编码规划
- 有点意思的C/C++问题及解答:11-15
- Django:DDTCMS新闻及图片处理方案
- 阿里软件接口开发基础(淘宝网) C#
- Django:DDTCMS新闻系统规划设计与实验
- du磁盘空间
- C#制作的GMail的邮箱阅读器