From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2555 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: NULL Date: Sat, 12 Jan 2013 01:46:11 -0500 Message-ID: <20130112064611.GG20323@brightrain.aerifal.cx> References: <50ED726B.7010201@barfooze.de> <1357972364.32505.4@driftwood> 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 1357973183 3735 80.91.229.3 (12 Jan 2013 06:46:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2013 06:46:23 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2556-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jan 12 07:46:41 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 1TturX-0002WV-Sr for gllmg-musl@plane.gmane.org; Sat, 12 Jan 2013 07:46:40 +0100 Original-Received: (qmail 21877 invoked by uid 550); 12 Jan 2013 06:46:23 -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 21868 invoked from network); 12 Jan 2013 06:46:23 -0000 Content-Disposition: inline In-Reply-To: <1357972364.32505.4@driftwood> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:2555 Archived-At: On Sat, Jan 12, 2013 at 12:32:44AM -0600, Rob Landley wrote: > On 01/09/2013 07:36:43 AM, John Spencer wrote: > >>using NULL in the argument of variadic functions is ub both > >>in c and c++ > > > >many developers don't care about the standard. they take the stance: > >"works for me, if you want it patched then do it yourself and > >we'll eventually merge" > > Why is it UB? The standard says it's a pointer. If you pull %p off > in printf, feeding NULL in that slot should work fine. See my other message. NULL is not required to have pointer type. It can be any null pointer constant, which includes things like 0, 0L, 0ULL, (sizeof 1 - sizeof 2), (void *)(1ULL/2ULL), etc. The %p specifier, on the other hand, requires an argument of type void *; passing any other type yields UB. Rich