Hello folks,
I'm writing a C++ project and reusing some C++ classes from previous projects based on other microcontrollers.
Since the DriverLib is, as far as I know, written in C the NULL pointer is defined in hw_types.h as follows:
//****************************************************************************
//
// For checking NULL pointers
//
//****************************************************************************
#ifndef NULL
#define NULL ((void *)0x0)
#endif
However, this definition is not being accepted by the compiler and when I replace the NULL by a constant 0 (zero) it works fine. (Based on a quick google on this issue, in C the macro NULL
may have the type void*, but that is not allowed in C++).
My question: is there a simple way to overwrite the NULL definition from DriverLib (in hw_types.h)? I would prefer don't change the library files locally.
I have on my code the following definition for NULL
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
However, it does not overwrite the NULL definition present on hw_types.h.
Any help would be very appreciated. Thank you.