Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: gcc needs a curly bracket matching/counting function Date: Tue, 20 Dec 2016 12:13:53 -0800 Organization: None to speak of Lines: 25 Message-ID: References: <35adab2b-9712-45ac-87ac-288c357a2040@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="b8044c752840ceb89291b47395d36dfc"; logging-data="5456"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18mF9Wb4fO+Rgm2CTjZkAAG" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:qQQ8S2DeZGi9R22lc8mEIN0dzz8= sha1:Hd/BnHakidnyCfGDvv6t3fMMRZY= Xref: csiph.com comp.lang.c:99932 Richard Heathfield writes: > On 20/12/16 18:46, DFS wrote: [...] >> So how do you identify that exact bracket as the problematic one? > > You look. If your indentation is right, it's not a problem. If your > indentation is wrong, pretty-print it. Then it's right. /Then/ look for > the wayward brace. If there's a missing brace at an intermediate level, pretty-printing (which typically assumes the braces are correct) can mess things up. In at least some cases, it's better to assume that the indentation is correct, and use that to find the missing brace. If the indentation and braces are both incorrect, you'll just have to study the code enough to understand its intended structure. To prevent this, try very hard to keep the indentation and braces correct as you make incremental changes. -- 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"