]> granicus.if.org Git - file/commitdiff
Add CCAST for const cast.
authorChristos Zoulas <christos@zoulas.com>
Mon, 9 Nov 2015 21:03:42 +0000 (21:03 +0000)
committerChristos Zoulas <christos@zoulas.com>
Mon, 9 Nov 2015 21:03:42 +0000 (21:03 +0000)
src/file.h

index 842a09eac7e35cb88d352a2e71d99958c636fa23..8d92702352ae25118ed7eff44d23f655790e5e80 100644 (file)
@@ -27,7 +27,7 @@
  */
 /*
  * file.h - definitions for file(1) program
- * @(#)$File: file.h,v 1.171 2015/08/30 14:16:33 christos Exp $
+ * @(#)$File: file.h,v 1.172 2015/09/11 17:24:09 christos Exp $
  */
 
 #ifndef __file_h__
@@ -365,9 +365,11 @@ struct mlist {
 #ifdef __cplusplus
 #define CAST(T, b)     static_cast<T>(b)
 #define RCAST(T, b)    reinterpret_cast<T>(b)
+#define CCAST(T, b)    const_cast<T>(b)
 #else
-#define CAST(T, b)     (T)(b)
-#define RCAST(T, b)    (T)(b)
+#define CAST(T, b)     ((T)(b))
+#define RCAST(T, b)    ((T)(b))
+#define CCAST(T, b)    ((T)(uintptr_t)(b))
 #endif
 
 struct level_info {