From owner-svn-src-head@freebsd.org Mon Mar 11 10:41:38 2019 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD1ED153C2B7; Mon, 11 Mar 2019 10:41:38 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 711798FF71; Mon, 11 Mar 2019 10:41:38 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 57DA5C99A; Mon, 11 Mar 2019 10:41:38 +0000 (UTC) Date: Mon, 11 Mar 2019 10:41:38 +0000 From: Alexey Dokuchaev To: Bruce Evans Cc: Justin Hibbits , Justin Hibbits , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r344960 - head/sys/powerpc/powerpc Message-ID: <20190311104138.GA60526@FreeBSD.org> References: <201903090318.x293IcLc023548@repo.freebsd.org> <20190309085058.GA60945@FreeBSD.org> <20190310171640.31bb9c54@titan.knownspace> <20190311191740.J2090@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190311191740.J2090@besplex.bde.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 711798FF71 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Mar 2019 10:41:39 -0000 On Mon, Mar 11, 2019 at 08:18:01PM +1100, Bruce Evans wrote: > ... > - poor formatting from %p. %p is guaranteed to bad for formatted output. > It is specified to give an (any) implementation-defined sequence of > printing characters. To use it except for low quality debugging > output, not quite as above (the above attempts medium quality, with > some alignment of fields but no attention to field widths for number > values), you first have to know what the implementation defines, > then don't use it when it is unsuitable. It is easiest to never use > it. In FreeBSD, printf(3) documents its format as being as if it > is %#x or %#lx. This gives no control over the field width. Yeah, this had annoyed me before, I recall some utilities suffer from broken formatting because of %p. > Conversion of pointers to uintmax_t or intmax_t gives full control > over the format, just like for converted integer types. This is not > quite easier and clearer for pointers. 3 casts are needed to go from > an arbitrary pointer to a uintmax_t. First to const volatile void * > (not to plain void *, since that gives cast-qual warnings if the > pointer is const or volatile). Then to uintptr_t. Then to uintmax_t. Thanks for the insight Bruce. ./danfe