aboutsummaryrefslogtreecommitdiff
path: root/libgcobol/common-defs.h
diff options
context:
space:
mode:
Diffstat (limited to 'libgcobol/common-defs.h')
-rw-r--r--libgcobol/common-defs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/libgcobol/common-defs.h b/libgcobol/common-defs.h
index a3884fd..15d0683 100644
--- a/libgcobol/common-defs.h
+++ b/libgcobol/common-defs.h
@@ -84,6 +84,14 @@
#define MINIMUM_ALLOCATION_SIZE 16
+// This was part of an exercise to make cppcheck shut up about invalid
+// pointer type conversions.
+// It was also to avoid having reinterpret_cast<> all over the place.
+// So, instead of reinterpret_cast<char *>(VALUE)
+// I sometimes use PTRCAST(char, VALUE)
+// Note that "(char *)" is implied by "PTRCAST(char, VALUE)"
+#define PTRCAST(TYPE, VALUE) static_cast<TYPE *>(static_cast<void *>(VALUE))
+
/*
* User-defined names in IBM COBOL can have at most 30 characters.
* For DBCS, the maximum is 14.