⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 900121_02.c

📁 linux下的gcc编译器
💻 C
字号:
// g++ 1.36.1 bug 900121_02// Assignment of structs is defined as memberwise assignment,// however g++ (1.36.2) and Cfront 2.0 differ on the definition// of assignment for unions.// (NOTE: Stroustrup now says that assignment of unions which contain either// members or sub-members (base classes are not allowed for unions) which// have non-default assignment operators defined for them will be illegal// in future.)// g++ (1.36.2) on the other hand, accepts this program without errors.// keywords: unions, operator=, inheritance, membersstruct s0 {  int i;  void operator= (s0 & arg)  {    this->i = arg.i;  }};struct s1 {  double d;  void operator= (s1 & arg)  {    this->d = arg.d;  }};union u0 {  s0 u0_member_0;		// ERROR -   s1 u0_member_1;		// ERROR - };void function (){  u0 u0_object_0;  u0 u0_object_1;  u0_object_0 = u0_object_1;};int main () { return 0; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -