Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Jan 1999 13:27:16 +1100
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        current@FreeBSD.ORG
Subject:   Re: btokup() macro in sys/malloc.h
Message-ID:  <99Jan28.131753est.40347@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help
Matthew Dillon <dillon@apollo.backplane.com> wrote:
>:>     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):
>
>    Then style(9) needs to be updated, because we have to add parenthesis
>    to be able to not get warnings with -Wall.

I'll support that.  The example given in style(9):

	a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1;

should rate as an entry in the Obfuscated C competition rather than
an example of maintainable code.

style(9) should emphasize legibility and maintainability, rather than
minimizing the number of extraneous (from the compiler's perspective)
parenthesis.  The code you're writing has to be maintained for many years
- and the maintainers will not always have your in-depth expertise.
The code also forms a `reference implementation' for someone who wants
to do something similar.

Peter

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?99Jan28.131753est.40347>