Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C Construction Problem Date: Wed, 21 Feb 2018 09:36:22 -0800 Organization: None to speak of Lines: 34 Message-ID: References: <1bpo4z63qj.fsf@pfeifferfamily.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="6d452d21b5716fd977ae48d3359c709a"; logging-data="16872"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/MAwDqFeY+W0kqsfdxiFPH" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:463i0lPhZDge8/QrB3QQitsc45w= sha1:z6InBIiFmvlIPtdJBJwK11d/Rvc= Xref: csiph.com comp.lang.c:126936 Gordon Burditt writes: >> To me, this was the confusing part. Why are the parentheses only >> around image? Shouldn't they be around the entire expression: > > >> &(image->clientData[0]) > > IMHO, you should almost always have at least one set of unnecessary > parentheses (and usually at least one set is necessary) around macro > arguments used in an expression, and if the expansion of the macro > is an expression and will be used as one, at least one set of > unnecessary parentheses (and usually at least one set is necessary) > around the entire expansion of the macro. An exception would be > if you are using token-pasting with the macro arguments. [...] > #define max(a,b) ((( ((((a))) >= (((b)))) ? (((a))) : (((b))) ))) [...] Is this a joke? #define MAX(a, b) ((a) >= (b) ? (a) : (b)) is entirely sufficient; any parentheses on top of that are just confusing. (As always, permission to quote my words is granted if and only if accompanied by a valid attribution line. Your claimed reasons for failing to do so are absurd.) -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"