From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2540 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: NULL Date: Wed, 9 Jan 2013 09:47:12 -0500 Message-ID: <20130109144712.GY20323@brightrain.aerifal.cx> References: <50ED4E45.6050801@barfooze.de> <50ED81BF.8030005@gentoo.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1357742844 12935 80.91.229.3 (9 Jan 2013 14:47:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Jan 2013 14:47:24 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2541-gllmg-musl=m.gmane.org@lists.openwall.com Wed Jan 09 15:47:42 2013 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1TswwP-0008SU-GW for gllmg-musl@plane.gmane.org; Wed, 09 Jan 2013 15:47:41 +0100 Original-Received: (qmail 19892 invoked by uid 550); 9 Jan 2013 14:47:25 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 19884 invoked from network); 9 Jan 2013 14:47:25 -0000 Content-Disposition: inline In-Reply-To: <50ED81BF.8030005@gentoo.org> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2540 Archived-At: On Wed, Jan 09, 2013 at 03:42:07PM +0100, Luca Barbato wrote: > On 09/01/13 12:02, John Spencer wrote: > > 2) change musl so it is compatible with those apps. this would mean: > > #if defined(__GNUC__) && defined(__cplusplus__) > > #define NULL __null > > #elif defined (__cplusplus__) > > #define NULL 0 > > #else > > #define NULL (void *) 0 /* for C code */ > > #end > > this change is the easiest solution: any problem will be magically fixed. > > I'm not sure if there is a way to warn properly at compile time for that > specific usage. __attribute__ ((sentinel)) may be used. Adding this to the appropriate gtk headers (even just as a temporary debugging measure if it's not desirable permanently) would catch all the bugs calling gtk variadic functions. > IMHO going with 2+3 is the only safe way to grant musl more support 2 is not appropriate as written (it's more complexity, and ugly, and in multiple locations). 3 already exists; it's called GCC. If we decide something is needed at the musl level, in my opinion the only acceptable solution is just replacing 0 with 0L unconditionally. Actually I'd like to remove the special-case for C++ and make NULL _always_ be defined to 0 or 0L, but I worry too many people would complain... > I wonder why in the hell C++ can't use the (void *) 0 definition or > equivalent. Because then char *s = NULL; would be a constraint violation. Rich