iostream中的extern对象
iostream中的对象用extern是多余????以下是vs2010中的代码用了extern修饰。。。。。感觉多余, 原因:使用者包含了iostream了,包含了这个头文件,就没有必要用extern了。。。。extern的正确用法为:同一个工程下,一个头文件中定义了一个变量,然后其他文件用extern 重新声明即可使用了。。。。。// iostream standard header for Microsoft#pragma once#ifndef _IOSTREAM_#define _IOSTREAM_#ifndef RC_INVOKED#include <istream> #pragma pack(push,_CRT_PACKING) #pragma warning(push,3)_STD_BEGIN #ifdef _M_CEE_PURE__PURE_APPDOMAIN_GLOBAL extern istream cin, *_Ptr_cin;__PURE_APPDOMAIN_GLOBAL extern ostream cout, *_Ptr_cout;__PURE_APPDOMAIN_GLOBAL extern ostream cerr, *_Ptr_cerr;__PURE_APPDOMAIN_GLOBAL extern ostream clog, *_Ptr_clog;__PURE_APPDOMAIN_GLOBAL extern wistream wcin, *_Ptr_wcin;__PURE_APPDOMAIN_GLOBAL extern wostream wcout, *_Ptr_wcout;__PURE_APPDOMAIN_GLOBAL extern wostream wcerr, *_Ptr_wcerr;__PURE_APPDOMAIN_GLOBAL extern wostream wclog, *_Ptr_wclog; #else /* _M_CEE_PURE */ // OBJECTS__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 istream cin, *_Ptr_cin;__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 ostream cout, *_Ptr_cout;__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 ostream cerr, *_Ptr_cerr;__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 ostream clog, *_Ptr_clog;__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 wistream wcin, *_Ptr_wcin;__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 wostream wcout, *_Ptr_wcout;__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 wostream wcerr, *_Ptr_wcerr;__PURE_APPDOMAIN_GLOBAL extern _CRTDATA2 wostream wclog, *_Ptr_wclog; // CLASS _Winitclass _CRTIMP2_PURE _Winit {public: __thiscall _Winit(); __thiscall ~_Winit();private: __PURE_APPDOMAIN_GLOBAL static int _Init_cnt; }; #endif /* _M_CEE_PURE */_STD_END #pragma warning(pop) #pragma pack(pop)#endif /* RC_INVOKED */#endif /* _IOSTREAM_ *//* * Copyright (c) 1992-2009 by P.J. Plauger. ALL RIGHTS RESERVED. * Consult your license regarding permissions and restrictions.V5.20:0009 */