Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Patch available for 3.0.6-pre-0
- X-seq: zsh-workers 6090
- From: Wayne Davison <wayne@xxxxxxxxx>
- To: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Patch available for 3.0.6-pre-0
- Date: Sat, 24 Apr 1999 00:12:22 -0700
- Cc: zsh-workers@xxxxxxxxxxxxxx
- In-reply-to: schaefer's message of Fri, 23 Apr 1999 21:32:08 -0700. <990423213208.ZM25952@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- Sender: wayne@xxxxxxxxx
"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..
Messages sorted by:
Reverse Date,
Date,
Thread,
Author