From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14385 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Define NULL as __null in C++ mode when using GCC or Clang. Date: Wed, 10 Jul 2019 16:48:12 -0400 Message-ID: <20190710204812.GV1506@brightrain.aerifal.cx> References: <20190709193826.GR1506@brightrain.aerifal.cx> <20190710020357.GI21055@port70.net> <871ryycs9n.fsf@oldenburg2.str.redhat.com> <20190710164446.GS1506@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="247962"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-14401-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jul 10 22:48:28 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hlJVr-0012R9-1A for gllmg-musl@m.gmane.org; Wed, 10 Jul 2019 22:48:27 +0200 Original-Received: (qmail 27993 invoked by uid 550); 10 Jul 2019 20:48:24 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 27973 invoked from network); 10 Jul 2019 20:48:24 -0000 Content-Disposition: inline In-Reply-To: Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:14385 Archived-At: On Wed, Jul 10, 2019 at 01:35:35PM -0400, James Y Knight wrote: > My leaning would kinda be to use > > nullptr in recent C++ versions and retain 0L for old ones if nullptr > > is a valid definition in new C++ versions, but I still wonder if > > having use of NULL "break maximally" isn't a better behavior with > > respect to ending its use... > > > > #define NULL nullptr is standards-valid in c++11 and later, but would be an > unfortunate choice to make. Both in terms of breaking working code (code > which is making unportable assumptions, granted), but also in terms of > breaking ABIs on valid code: changing the type from long to > decltype(nullptr) changes mangling, etc. Could you clarify how it "breaks ABI"? NULL is not a type but a macro expanding to an expression. Does its type somehow leak into mangled symbol names via templates or something? If so, this is a complication to any proposed change of the type. Rich