summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2018-10-03 15:58:39 -0700
committerAndreas Rumpf <rumpf_a@web.de>2018-10-08 14:05:43 +0200
commit403f5aea1468f8e686134834e72c8ba326688643 (patch)
tree7e0abb0467d5e112a84bd8bd31c78b769e6ed4ac /lib
parent269b957e2968345a4c9a5037ab97ab726135a921 (diff)
downloadNim-403f5aea1468f8e686134834e72c8ba326688643.tar.gz
define NIM_NIL nullptr when __cplusplus >= 201103L
Diffstat (limited to 'lib')
-rw-r--r--lib/nimbase.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/nimbase.h b/lib/nimbase.h
index c04d378c5..2cb632787 100644
--- a/lib/nimbase.h
+++ b/lib/nimbase.h
@@ -280,7 +280,13 @@ namespace USE_NIM_NAMESPACE {
 #    define NIM_FALSE false
 #  endif
 #  define NIM_BOOL bool
-#  define NIM_NIL 0
+#  if __cplusplus >= 201103L
+#    /* nullptr is more type safe (less implicit conversions than 0) */
+#    define NIM_NIL nullptr
+#  else
+#    /* consider using NULL if comment below for NIM_NIL doesn't apply to C++ */
+#    define NIM_NIL 0
+#  endif
 #else
 #  ifdef bool
 #    define NIM_BOOL bool