From owner-freebsd-current Wed Jan 27 16:37:39 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA09077 for freebsd-current-outgoing; Wed, 27 Jan 1999 16:37:39 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from wall.polstra.com (rtrwan160.accessone.com [206.213.115.74]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA09071 for ; Wed, 27 Jan 1999 16:37:37 -0800 (PST) (envelope-from jdp@polstra.com) Received: from vashon.polstra.com (vashon.polstra.com [206.213.73.13]) by wall.polstra.com (8.9.1/8.9.1) with ESMTP id QAA02156; Wed, 27 Jan 1999 16:37:36 -0800 (PST) (envelope-from jdp@polstra.com) From: John Polstra Received: (from jdp@localhost) by vashon.polstra.com (8.9.1/8.9.1) id QAA27694; Wed, 27 Jan 1999 16:37:35 -0800 (PST) (envelope-from jdp@polstra.com) Date: Wed, 27 Jan 1999 16:37:35 -0800 (PST) Message-Id: <199901280037.QAA27694@vashon.polstra.com> To: dillon@apollo.backplane.com Subject: Re: btokup() macro in sys/malloc.h Newsgroups: polstra.freebsd.current In-Reply-To: <199901272128.NAA56542@apollo.backplane.com> Organization: Polstra & Co., Seattle, WA Cc: current@FreeBSD.ORG Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article <199901272128.NAA56542@apollo.backplane.com>, Matthew Dillon wrote: > Is this parenthesization correct ? > > OLD > > #define btokup(addr) (&kmemusage[(caddr_t)(addr) - kmembase >> PAGE_SHIFT]) > > NEW > > #define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> PAGE_SHIFT]) The added parentheses don't make any difference, semantically. This change probably wouldn't meet the criteria spelled out in style(9): Unary operators don't require spaces, binary operators do. Don't use parentheses unless they're required for precedence, or the statement is really confusing without them. a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1; k = !(l & FLAGS); John -- John Polstra jdp@polstra.com John D. Polstra & Co., Inc. Seattle, Washington USA "Nobody ever went broke underestimating the taste of the American public." -- H. L. Mencken To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message