Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Jul 2019 10:46:04 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: [PATCH] Define NULL as __null in C++ mode when using GCC
 or Clang.

* Florian Weimer <fweimer@...hat.com> [2019-07-10 08:34:12 +0200]:
> * Szabolcs Nagy:
> > it is clear that 0L is a conforming definition for all
> > conforming c++ compilers.
> >
> > it is less clear if __null is so in all compilers that
> > define __GNUC__.
> 
> Why wouldn't something like this be valid for current C++ versions?

if you aim for current c++ only then you need
even more ifdefs (#if __cplusplus > ..).

> static inline constexpr decltype(nullptr) __null{};
> #define NULL __null
> 
> I don't see a requirement that NULL must be an expression that can be
> evaluated by the preprocessor.

c++03 requires an integral const expr.,
integral const expr must be usable in #if.
c++11 quietly changed that.

in this case that works out though: undefined
identifiers are 0 in #if, so #if __null works
as expected.

stringification is probably not a valid argument.

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.