简体   繁体   中英

How cout is for static duration?

cout - C++ Reference

The object is declared in header with external linkage and static duration: it lasts the entire duration of the program.

I am using Visual Studio. If I go to its declaration it is like,

__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 ostream cout, *_Ptr_cout;

I understand its external linkage, but how it is static duration?

[basic.stc.static]/1 :

All variables which do not have dynamic storage duration, do not have thread storage duration, and are not local have static storage duration . The storage for these entities shall last for the duration of the program

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM