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
This commit is contained in:
patacongo
2012-08-12 17:49:35 +00:00
parent b7a1b00c08
commit 7e20685e1a
2 changed files with 8 additions and 3 deletions
+2
View File
@@ -3158,3 +3158,5 @@
abort return EINTR (or a short transfer size) if a signal is received 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 while waiting to receive or send serial data. This behavior is required
by POSIX. by POSIX.
* include/sys/types.h: Define NULL to be (0) if __cplusplus is defined.
(contributed by Mike Smith)
+6 -3
View File
@@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* include/sys/types.h * 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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * 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) */ /* NULL is usually defined in stddef.h (which includes this file) */
#ifndef NULL #ifndef NULL
/* SDCC is sensitive to NULL pointer type conversions */ /* SDCC is sensitive to NULL pointer type conversions, and C++ defines
# ifdef SDCC * NULL as zero
*/
# if defined(SDCC) || defined(__cplusplus)
# define NULL (0) # define NULL (0)
# else # else
# define NULL ((void*)0) # define NULL ((void*)0)