From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/2558 Path: news.gmane.org!not-for-mail From: Luca Barbato Newsgroups: gmane.linux.lib.musl.general Subject: Re: NULL Date: Sat, 12 Jan 2013 08:15:21 +0100 Message-ID: <50F10D89.4050909@gentoo.org> References: <50ED726B.7010201@barfooze.de> <1357972364.32505.4@driftwood> <20130112064611.GG20323@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1357974938 18485 80.91.229.3 (12 Jan 2013 07:15:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2013 07:15:38 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-2559-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jan 12 08:15:54 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 1TtvJn-0005nn-Lu for gllmg-musl@plane.gmane.org; Sat, 12 Jan 2013 08:15:51 +0100 Original-Received: (qmail 32466 invoked by uid 550); 12 Jan 2013 07:15:35 -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 32453 invoked from network); 12 Jan 2013 07:15:35 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 In-Reply-To: <20130112064611.GG20323@brightrain.aerifal.cx> X-Enigmail-Version: 1.4.6 Xref: news.gmane.org gmane.linux.lib.musl.general:2558 Archived-At: On 12/01/13 07:46, Rich Felker wrote: > 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. so printf("%s", NULL) would lead to UB if NULL is 0L ? lu