zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayne@clari.net>
To: "Bart Schaefer" <schaefer@brasslantern.com>
Cc: zsh-workers@sunsite.auc.dk
Subject: Re: Patch available for 3.0.6-pre-0
Date: Sat, 24 Apr 1999 00:12:22 -0700	[thread overview]
Message-ID: <199904240712.AAA14094@bebop.clari.net> (raw)
In-Reply-To: schaefer's message of Fri, 23 Apr 1999 21:32:08 -0700. <990423213208.ZM25952@candle.brasslantern.com>

"Bart Schaefer" writes:
> Exactly what warning were you silencing in this case?

The "ambiguous else" warning.  A brace-less "if" that has an "if"
macro after it gets turned into "if (...) if (...) ... else ...",
which causes the warning.  My solution was to add the braces to the
calling "if", which turns it into "if (...) { if (...) ... else ... }".

> The reason most of those macros look like
>     #define thing() if (! testthing) {;} else dothing
> and *not*
>     #define thing() if (testthing) dothing
> is to prevent ambiguous/erroneous "else" situations.

Yeah, I'm familiar with the dangers of adding such else-less ifs via
a macro.  My statement was mainly meant to explain why some ifs that
are followed by a single line needed braces added to them (since it
would be easy for you to look at what I'd done and think that I was
just not following the current coding style).

I personally don't think that we need to change the macros for the
release of 3.0.6, but I figured I'd mention it in case you felt
otherwise.  Long term, I think that we should consolidate all the
multi-line macros into a single style that avoids ambiguous-else
warnings, but that work may not affect the 3.0.* code base.

I also agree with you that the "do { ... } while (0)" style is one
of the best when a macro includes multiple lines of code (since I
personally dislike omitting semi-colons from the macro references).
I hadn't noticed that this was used in the code -- I just saw some
defines being called without semi-colons, and I assumed that that
was the zsh style.

..wayne..


  reply	other threads:[~1999-04-24  7:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-21  8:15 Bart Schaefer
1999-04-21  8:47 ` Peter Stephenson
1999-04-21 14:14 ` Tatsuo Furukawa
1999-04-21 16:05   ` Bart Schaefer
1999-04-22 15:07     ` Tatsuo Furukawa
1999-04-24  5:53       ` Bart Schaefer
1999-04-25  6:57         ` Geoff Wing
1999-04-26 15:22           ` Tatsuo Furukawa
1999-04-27 16:24             ` Bart Schaefer
1999-04-21 23:52 ` Wayne Davison
1999-04-24  4:32   ` Bart Schaefer
1999-04-24  7:12     ` Wayne Davison [this message]
1999-04-23 12:48 Sven Wischnowsky
1999-04-23 14:13 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199904240712.AAA14094@bebop.clari.net \
    --to=wayne@clari.net \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).