瀏覽代碼

improve iswdigit macro to diagnose errors

this is analogous to commit 2ca55a93f2a11185d72dcb69006fd2c30b5c3144
for the macros in ctype.h.
Rich Felker 10 年之前
父節點
當前提交
d0040e239e
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      include/wchar.h
  2. 1 1
      include/wctype.h

+ 1 - 1
include/wchar.h

@@ -175,7 +175,7 @@ wctype_t  wctype(const char *);
 
 #ifndef __cplusplus
 #undef iswdigit
-#define iswdigit(a) ((unsigned)(a)-'0' < 10)
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
 #endif
 #endif
 

+ 1 - 1
include/wctype.h

@@ -45,7 +45,7 @@ wctype_t  wctype(const char *);
 
 #ifndef __cplusplus
 #undef iswdigit
-#define iswdigit(a) (((unsigned)(a)-L'0') < 10)
+#define iswdigit(a) (0 ? iswdigit(a) : ((unsigned)(a)-'0') < 10)
 #endif
 
 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \