From owner-freebsd-current Wed Sep 16 06:52:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA13888 for freebsd-current-outgoing; Wed, 16 Sep 1998 06:52:45 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.15.68.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA13867 for ; Wed, 16 Sep 1998 06:52:39 -0700 (PDT) (envelope-from bde@godzilla.zeta.org.au) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.7/8.8.7) id XAA07659; Wed, 16 Sep 1998 23:52:16 +1000 Date: Wed, 16 Sep 1998 23:52:16 +1000 From: Bruce Evans Message-Id: <199809161352.XAA07659@godzilla.zeta.org.au> To: bde@zeta.org.au, gibbs@plutotech.com Subject: Re: New kernel compile warnings with CAM Cc: current@FreeBSD.ORG, Don.Lewis@tsc.tdk.com Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >>%p requires a `void *' arg. >What's the official policy here? I used a cast of (intptr_t) in the >changes I submitted, but if we should be using %p and (void *) instead, >so be it. Casts (to_intptr_t) require a `void *' operand (at least if you want intptr_t to be guaranteed to not lose information and don't want to see the raw bits in the pointer). Also, the width of intptr_t is machine-dependent. This makes printing pointers by casting to (intptr_t) even more onerous than printing them by casting to (void *), e.g.: struct foo *bar; printf("%?\n", (intptr_t)(void *)bar); where '?' is a machine-dependent format suitable for intptr_t's. %p should be used for pointers except possibly where you want complete control of the format or want to see the raw bits in the pointer. Anything that requires a cast should be avoided since casts defeat type checking and may cause undetected overflow. Unfortunately, %p usually requires a cast. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message