From 403f5aea1468f8e686134834e72c8ba326688643 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Wed, 3 Oct 2018 15:58:39 -0700 Subject: [PATCH] define NIM_NIL nullptr when __cplusplus >= 201103L --- lib/nimbase.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/nimbase.h b/lib/nimbase.h index c04d378c54..2cb632787a 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