寻高手解释下iostream解决办法
寻高手解释下iostream
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _IOSTREAM_
#define _IOSTREAM_
#include <istream>
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
_STD_BEGIN
// OBJECTS
static ios_base::Init _Ios_init;
extern _CRTIMP istream cin;
extern _CRTIMP ostream cout;
extern _CRTIMP ostream cerr, clog;
// CLASS _Winit
class _CRTIMP _Winit {
public:
_Winit();
~_Winit();
private:
static int _Init_cnt;
};
// WIDE OBJECTS
static _Winit _Wios_init;
extern _CRTIMP wistream wcin;
extern _CRTIMP wostream wcout, wcerr, wclog;
_STD_END
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _IOSTREAM_ */
以上是头文件iostream 的内容,不懂它什么意思,哪位高手给个详细点的解释啊
还有那个#pragma pack(pop)是什么意思?
------解决方案--------------------
#pragma pack(push,8) //设定 内存对齐align 为 8,就是最大对齐到8
...
#pragma pack(pop) //复位设定的对齐数据,使用系统默认对齐,或者不使用对齐
------解决方案--------------------
如果真的对其是实现有兴趣,
可以参看一下 STL源码剖析。
下载:
http://www.ccrun.com/view.asp?id=336
jjhou.****.net/efile-tass.htm
------解决方案--------------------
#if _MSC_VER > 1000
#pragma once
#endif
-------------------------
_MSC_VER 是编译器的版本号
1310 是vc2003
1400 是vc2005
#pragma once 是确保这个文件之被载入一次
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
---------------------------
如果编译器版本号被定义
就采用 8 字节数据对齐
_STD_BEGIN 表示开始定义标准库内容
它是个宏如下
#define _STD_BEGIN namespace std {
#define _STD_END }
static ios_base::Init _Ios_init;
extern _CRTIMP istream cin;
extern _CRTIMP ostream cout;
extern _CRTIMP ostream cerr, clog;
// CLASS _Winit
class _CRTIMP _Winit {
public:
_Winit();
~_Winit();
private:
static int _Init_cnt;
};
// WIDE OBJECTS
static _Winit _Wios_init;
extern _CRTIMP wistream wcin;
extern _CRTIMP wostream wcout, wcerr, wclog;
_STD_END
----------------
声明常用的文件流如 cout cin
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MS
------------------
恢复数据对齐格式
#if _MSC_VER > 1000
#pragma once
#endif
#ifndef _IOSTREAM_
#define _IOSTREAM_
#include <istream>
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
_STD_BEGIN
// OBJECTS
static ios_base::Init _Ios_init;
extern _CRTIMP istream cin;
extern _CRTIMP ostream cout;
extern _CRTIMP ostream cerr, clog;
// CLASS _Winit
class _CRTIMP _Winit {
public:
_Winit();
~_Winit();
private:
static int _Init_cnt;
};
// WIDE OBJECTS
static _Winit _Wios_init;
extern _CRTIMP wistream wcin;
extern _CRTIMP wostream wcout, wcerr, wclog;
_STD_END
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
#endif /* _IOSTREAM_ */
以上是头文件iostream 的内容,不懂它什么意思,哪位高手给个详细点的解释啊
还有那个#pragma pack(pop)是什么意思?
------解决方案--------------------
#pragma pack(push,8) //设定 内存对齐align 为 8,就是最大对齐到8
...
#pragma pack(pop) //复位设定的对齐数据,使用系统默认对齐,或者不使用对齐
------解决方案--------------------
如果真的对其是实现有兴趣,
可以参看一下 STL源码剖析。
下载:
http://www.ccrun.com/view.asp?id=336
jjhou.****.net/efile-tass.htm
------解决方案--------------------
#if _MSC_VER > 1000
#pragma once
#endif
-------------------------
_MSC_VER 是编译器的版本号
1310 是vc2003
1400 是vc2005
#pragma once 是确保这个文件之被载入一次
#ifdef _MSC_VER
#pragma pack(push,8)
#endif /* _MSC_VER */
---------------------------
如果编译器版本号被定义
就采用 8 字节数据对齐
_STD_BEGIN 表示开始定义标准库内容
它是个宏如下
#define _STD_BEGIN namespace std {
#define _STD_END }
static ios_base::Init _Ios_init;
extern _CRTIMP istream cin;
extern _CRTIMP ostream cout;
extern _CRTIMP ostream cerr, clog;
// CLASS _Winit
class _CRTIMP _Winit {
public:
_Winit();
~_Winit();
private:
static int _Init_cnt;
};
// WIDE OBJECTS
static _Winit _Wios_init;
extern _CRTIMP wistream wcin;
extern _CRTIMP wostream wcout, wcerr, wclog;
_STD_END
----------------
声明常用的文件流如 cout cin
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MS
------------------
恢复数据对齐格式