Storage duration
Storage duration,顾名思义,存储空间本身的持续时间。它应当不小于其所包含对象的生存周期(object lifetime)。
标准原文
和 C99,C++03比,新标准增加了一个thread相关的storage duration。
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
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)
C
存储类别说明符
- typedef
- extern
- static
_Thread_local
- auto
- register
注:typedef归于此类仅是出于语法上的便利。
而以下四个称为类型限定符(Type qualifiers)
- const
- restrict
- volatile
- _Atomic
分享到:
相关推荐
比较好的C++解析Javascript示例,实现的功能有: 1.C++创建对象Javascript调用 2.Javascript 创建对象C++调用 3.C++创建函数由Javascript回调 4.Javascript创建函数由C++回调 ...
数据库功能模拟Storage and Buffer Manager C++实现
HCIA-Storage V5.0 学习文档 HCIA-Storage V5.0实验手册
The object lifecycle including storage duration, memory management, exceptions, call stacks, and the RAII paradigm Compile-time polymorphism with templates and run-time polymorphism with virtual ...
C++语言本地API接口,提供虚拟机操作、文件系统、启动器、镜像文件等相关能力。
HCIE-Storage V2.5 学习指导手册.docx
HCIE-Storage V3.0 学习文档 HCIE-Storage V3.0 实验手册
HCIP-Storage V5.0 学习文档 HCIP-Storage V5.0 实验手册
程序运行有时需要更高的权限做更多的事情,本代码就是让c++程序获取system权限的代码
IBM System Storage DS Storage Manager 安装和支持指南
A Brief History of C++ C++ Organization How to Learn C++ 2. The Basics of Program Writing Programs from Conception to Execution Creating a Real Program Getting Help in Unix Getting Help in an IDE ...
华为HCIE-Storage备考学习资料《HCIE-Storage实战宝典》合集
注意:本文所说的全局变量指的是 variables with static storage,措词来自 c++ 的语言标准文档。 什么时候初始化 根据 C++ 标准,全局变量的初始化要在 main 函数执行前完成,常识无疑,但是这个说法有点含糊...
Universal Serial Bus Mass Storage Class Bulk-Only Transport <br>This specification addresses Bulk-Only Transport, or in other words, transport of command, data, and status occurring solely ...
c/c++ windows 通过winrt操作ble 蓝牙 #include #include #include #include <winrt/Windows.Foundation.Collections.h> #include #include #include #include #include <winrt/Windows.Storage.Streams.h>
Whether you’re preparing for the CompTIA Storage+ exam or simply seeking a deeper understanding of data storage networks, this Sybex guide will help you get there. This book covers data storage from ...
存储期可以分为静态存储期(static storage duration)和动态存储期(dynamic storage duration)。这是由变量的静态存储方式和动态存储方式决定的。 所谓静态存储方式是指在程序运行期间,系统对变量分配固定的存储空间...
电子-MassStorage协议学习报告.rar,单片机/嵌入式STM32-F0/F1/F2
HCIE-Storage存储学习必备脑图,很全,很完美
IBM DS4000 storage mangager