From 7e20685e1af70673d084a357400d5dfd064ee615 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 12 Aug 2012 17:49:35 +0000 Subject: [PATCH] Define NULL to be (0) for C++ git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5023 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 2 ++ include/sys/types.h | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78a6323ddef..bb433d6cdaa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3158,3 +3158,5 @@ abort return EINTR (or a short transfer size) if a signal is received while waiting to receive or send serial data. This behavior is required by POSIX. + * include/sys/types.h: Define NULL to be (0) if __cplusplus is defined. + (contributed by Mike Smith) diff --git a/include/sys/types.h b/include/sys/types.h index 6014b9b74db..2ae69d4a7e4 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/sys/types.h * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -63,8 +63,11 @@ /* NULL is usually defined in stddef.h (which includes this file) */ #ifndef NULL - /* SDCC is sensitive to NULL pointer type conversions */ -# ifdef SDCC + /* SDCC is sensitive to NULL pointer type conversions, and C++ defines + * NULL as zero + */ + +# if defined(SDCC) || defined(__cplusplus) # define NULL (0) # else # define NULL ((void*)0)