Automatic Objects and Local static Objects
来源:互联网 发布:金和网络财报2017 编辑:程序博客网 时间:2024/06/11 00:25
Automatic Objects
The objects that correspond to ordinary local variables are created when the function's control path passes through the variable's defintion. They are destroyed when control passes through the end of the block in which the variable is defined.Objects that exist only while a block is executing are known as automatic objects. After execution exits a block, the values of the automatic objects created in that block are undefined.
Parameters are automatic objects. Storage for the parameters is allocated when the function begins. Parameters are defined inthe scope of the function body. Hence they are destroyed when the function terminates.
Automatic objects corresponding to the function's parameters are initialized by the arguments passed to the function. Automatic objects corresponding to local variables are initialized if their definition contains an initializer. Otherwise, they are default initialized, which means that uninitialized local variables of built-in type have undefined values.
Local static Objects
It can be useful to have a local variable whose lifetime continues across calls to the function. We obtain such objects by defining a local variable as static. Each local static object is initialized before the first time execution passes through the object's definition. Local statics are not destroyed when a function ends; they are destroyed when the program terminates.
... ...
If a local static has no explicit initializer, it's value initialized, meaning that local statics of built-in type are initialized to zero.
- Automatic Objects and Local static Objects
- Imperfect C++:Chapter 11 Statics:11.3Function-Local static objects
- c++ 局部静态变量(Local Static Objects)
- EL Implicit Objects and JSP Implicit Objects
- COM Objects and Interfaces
- Interfaces and Scripting Objects
- Primitive Types and Objects
- Classes and Objects
- Defining Classes and Objects
- Primitive values and Objects
- Textures objects and parameters
- Mutable and Immutable Objects
- Request and Response objects
- ECMAScript5 Objects and Properties
- Python Types and Objects
- DDL and Schema Objects
- Framebuffer and Renderbuffer Objects
- Classes, Objects, and Methods
- bash 启动脚本
- AWS等入华对国内云计算产业和公有云市场格局的影响
- linux SPI驱动 - 模拟gpio
- Android异步处理一:使用Thread+Handler实现非UI线程更新UI界面
- (9)Java集合框架
- Automatic Objects and Local static Objects
- Android异步处理二:使用AsyncTask异步更新UI界面
- 6.asm-BSF、BSR: 位扫描指令(找到最开始的1所在位置)
- JOGL
- (pthread_cond_signal)和(pthread_cond_wait)
- Asp.net Strong type Session
- extern "C"的用法解析
- 初学WebService
- Android异步处理三:Handler+Looper+MessageQueue深入详解