Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Jan 1999 16:37:35 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        dillon@apollo.backplane.com
Cc:        current@FreeBSD.ORG
Subject:   Re: btokup() macro in sys/malloc.h
Message-ID:  <199901280037.QAA27694@vashon.polstra.com>
In-Reply-To: <199901272128.NAA56542@apollo.backplane.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <199901272128.NAA56542@apollo.backplane.com>,
Matthew Dillon  <dillon@apollo.backplane.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901280037.QAA27694>