Re: Stupid mwcc compilers ...

Thomas Fletcher (thomasf@qnx.com)
Wed, 9 Jun 1999 12:16:21 -0400


Hmm, I was looking at the wrong version of the spec. Apparently
it is not valid C++ as I had proclaimed earlier, and mwcc
is not as braindead as I thought.

So I guess that the moral of the story is don't use any
variables declared in the the for loop scoping outside
of the for loop. I've fixed a couple of places in the
mswordview and the rtf import/export that this cropped
up in in the past few months.

Thomas

On Wed, 9 Jun 1999, Shaw Terwilliger wrote:

> Hate to reply to my own message, but...
>
> On Wed, Jun 09, 1999 at 08:45:06AM -0500, Shaw Terwilliger wrote:
> > 4 Names declared in the for-init-statement, and in the condition of if,
> > while, for, and switch statements are local to the if, while, for, or
> > switch statement (including the controlled statement), and shall not
> > be redeclared in a subsequent condition of that statement nor in the
> > outermost block (or, for the if statement, any of the outermost
> > blocks) of the controlled statement; see _stmt.select_.
> >
> > But I'm really not sure how I should interpret that. It says "shall
> > not be redeclared in ... the outermost block", which I read as the
> > parent block of the conditional. But though it does say I'm not supposed
> > to use that name at that level, I'm not sure whether it means the existing
> > one is available there.
>
> By reading through more of the draft spec, it's pretty obvious by
> "outermost block of the controlled statement" and "subsequent condition"
> they mean any other {} after a conditional or an elseif()/case:
> respectively.
>
> --
> Shaw Terwilliger
>
-------------------------------------------------------------
Thomas (toe-mah) Fletcher QNX Software Systems
thomasf@qnx.com Neutrino Development Group
(613)-591-0931 http://www.qnx.com/~thomasf



This archive was generated by hypermail 1.03b2.