cxx-ivars-3.mm
来自「linux下编程用 编译软件」· MM 代码 · 共 47 行
MM
47 行
// Check if ObjC classes with non-POD C++ ivars are specially marked in the metadata.// { dg-do run { target *-*-darwin* } }// { dg-options "-fobjc-call-cxx-cdtors -fnext-runtime" }#include <objc/objc-runtime.h>#include <stdlib.h>#define CHECK_IF(expr) if(!(expr)) abort()#ifndef CLS_HAS_CXX_STRUCTORS#define CLS_HAS_CXX_STRUCTORS 0x2000L#endifstruct cxx_struct { int a, b; cxx_struct (void) { a = b = 55; }};@interface Foo { int c; cxx_struct s;}@end@interface Bar: Foo { float f;}@end@implementation Foo@end@implementation Bar@endint main (void){ Class cls; cls = objc_getClass("Foo"); CHECK_IF(cls->info & CLS_HAS_CXX_STRUCTORS); cls = objc_getClass("Bar"); CHECK_IF(!(cls->info & CLS_HAS_CXX_STRUCTORS)); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?