浏览代码

sokol_app/gfx.h: fix _*_CLEAR_ARC_STRUCT macros for C++98 (fixes #685)

Andre Weissflog 3 年之前
父节点
当前提交
fdd9a15ec2
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      sokol_app.h
  2. 1 1
      sokol_gfx.h

+ 1 - 1
sokol_app.h

@@ -2511,7 +2511,7 @@ typedef struct {
 #if defined(_SAPP_MACOS) || defined(_SAPP_IOS)
     // this is ARC compatible
     #if defined(__cplusplus)
-        #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = { }; }
+        #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = type(); }
     #else
         #define _SAPP_CLEAR_ARC_STRUCT(type, item) { item = (type) { 0 }; }
     #endif

+ 1 - 1
sokol_gfx.h

@@ -4278,7 +4278,7 @@ static _sg_state_t _sg;
 // a helper macro to clear a struct with potentially ARC'ed ObjC references
 #if defined(SOKOL_METAL)
     #if defined(__cplusplus)
-        #define _SG_CLEAR_ARC_STRUCT(type, item) { item = { }; }
+        #define _SG_CLEAR_ARC_STRUCT(type, item) { item = type(); }
     #else
         #define _SG_CLEAR_ARC_STRUCT(type, item) { item = (type) { 0 }; }
     #endif