Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2002 16:24:21 +0200 (CEST)
From:      Harti Brandt <brandt@fokus.gmd.de>
To:        Juli Mallett <jmallett@FreeBSD.ORG>
Cc:        Tony Finch <fanf@FreeBSD.ORG>, <cvs-committers@FreeBSD.ORG>, <cvs-all@FreeBSD.ORG>
Subject:   Re: cvs commit: src/share/man/man9 style.9
Message-ID:  <20020910161928.E64100-100000@beagle.fokus.gmd.de>
In-Reply-To: <20020910071126.B44916@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 10 Sep 2002, Juli Mallett wrote:

JM>* De: Tony Finch <fanf@FreeBSD.org> [ Data: 2002-09-10 ]
JM>	[ Subjecte: cvs commit: src/share/man/man9 style.9 ]
JM>> fanf        2002/09/10 03:54:40 PDT
JM>>
JM>>   Modified files:
JM>>     share/man/man9       style.9
JM>>   Log:
JM>>   Remove a sentence about wrapping macro definitions in bare braces,
JM>>   which became wrong after using do { } while (0) became recommended.
JM>>   Move the definition of what braces are to their new first occurrence.
JM>>
JM>>   Reviewed by:    bde
JM>
JM>Any chance of us adopting the Mach (and Lites) policy of doing
JM><sys/macro_help.h> (actually <mach/macro_help.h>), and having some
JM>macros like
JM>
JM>#define	MACRO_BEGIN	do {
JM>#define	MACRO_END	} while(0)	/* or with a ; if you like that */
JM>
JM>?
JM>
JM>IMHO this actually reduces the amount of obfuscation, because it makes
JM>it clear what the statements are actually there to accomplish, and
JM>keeps the braces from running into/obfuscating braces with meaning.

Have a look at the original v7 sh sources and you see that this kind of
stuff actually adds obfuscation. If you use these defines every day, you
know what they stand for, if you don't you have to lookup the definition
each time you see such a define used. This makes reading code a lot
harder.

Adding a ; to MACRO_END would be a bad idea, if a macro defined with
MACRO_END would be used in an if() statement without braces.

harti

-- 
harti brandt, http://www.fokus.gmd.de/research/cc/cats/employees/hartmut.brandt/private
              brandt@fokus.gmd.de, brandt@fokus.fhg.de


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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