Quantcast
Viewing all articles
Browse latest Browse all 4845

Commented Unassigned: nullptr defined as NULL on g++ [340]

Using g++ with C++ Rest SDK redefines nullptr as NULL even if nullptr is available.

In file include/cpprest/details/SafeInt3.hpp the following code is used to check if nullptr is available:

```
#if defined nullptr_t
#define NEEDS_NULLPTR_DEFINED 0
#else
#define NEEDS_NULLPTR_DEFINED 1
#endif
...
#if NEEDS_NULLPTR_DEFINED
#define nullptr NULL
#endif
```
However this is not a valid check (nullptr_t is a type so #if defined nullptr_t always evaluate to false leading to NEEDS_NULLPTR_DEFINED always beeing defined to 1).

Trying to change
```
#if defined nullptr_t
```
to
```
#if __cplusplus >= 201103L
```
which seems to be a more valid check breaks compilation (c.f. build_output.txt) of C++ REST SDK on my machine (using g++ 4.9.2 and boost 1.57.0).
Comments: Fixed in the development branch by the following pull request: https://casablanca.codeplex.com/SourceControl/network/forks/simonlep/cpprest/contribution/8067#!/tab/comments Will be in the 2.5.0 release. Steve

Viewing all articles
Browse latest Browse all 4845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>