mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-06 23:02:10 +03:00
define NULL as nullptr when used in C++11 or later
This should be safer for casting and more compatible with existing code bases that wrongly assume it must be defined as a pointer.
This commit is contained in:
parent
8274aaaaa1
commit
98e688a9da
@ -7,7 +7,9 @@ extern "C" {
|
|||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#ifndef _STDDEF_H
|
#ifndef _STDDEF_H
|
||||||
#define _STDDEF_H
|
#define _STDDEF_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
@ -25,7 +25,9 @@ extern "C" {
|
|||||||
|
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
@ -7,7 +7,9 @@ extern "C" {
|
|||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
@ -7,7 +7,9 @@ extern "C" {
|
|||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
@ -7,7 +7,9 @@ extern "C" {
|
|||||||
|
|
||||||
#include <features.h>
|
#include <features.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
@ -15,7 +15,9 @@ extern "C" {
|
|||||||
#define SEEK_CUR 1
|
#define SEEK_CUR 1
|
||||||
#define SEEK_END 2
|
#define SEEK_END 2
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
@ -38,7 +38,9 @@ extern "C" {
|
|||||||
#define WCHAR_MIN (-1-0x7fffffff+L'\0')
|
#define WCHAR_MIN (-1-0x7fffffff+L'\0')
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if __cplusplus >= 201103L
|
||||||
|
#define NULL nullptr
|
||||||
|
#elif defined(__cplusplus)
|
||||||
#define NULL 0L
|
#define NULL 0L
|
||||||
#else
|
#else
|
||||||
#define NULL ((void*)0)
|
#define NULL ((void*)0)
|
||||||
|
Loading…
Reference in New Issue
Block a user