Re: Using Wildcards in a Select Case Statement ?
From: Duane Bozarth (dp_bozarth_at_swko.dot.net)
Date: 07/15/04
- Next message: Duane Bozarth: "Re: Can not compile"
- Previous message: Randy Birch: "Re: Using Wildcards in a Select Case Statement ?"
- In reply to: Bob O`Bob: "Re: Using Wildcards in a Select Case Statement ?"
- Next in thread: Gale Green: "Re: Using Wildcards in a Select Case Statement ?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 15 Jul 2004 13:47:25 -0500
Bob O`Bob wrote:
>
> Gale Green wrote:
>
> > I *never* alter the value of the control variable of a For loop (and I
> > never rely on its contents after the loop either). If the variable
> > needs manual intervention during processing, for whatever reason, I
> > use Do...Loop, because the While/Until <condition> tells you that the
> > variable is changed inside the loop. There is also sometimes the
> > advantage that, after a Do...Loop, you *can* rely on the remanent
> > value of the control variable.
>
> I do it frequently
> (alter the For loop variable, and/or rely on its value after loop exit)
> It's always been safe, predictable, and 100% reliable for me.
That, of course, is dependent on the language specification (and then
the quality of the implementation for those that have formal Standards),
but at least for those with formal Standards it is known what the proper
behavior is supposed to be. I've never seen it documented conclusively
for VB and again a quick search didn't turn up any mention of a defined
behavior on exit. It's a case of "it may work, but there's no guarantee
it will always be that way". Since it's unlikely the compiler will now
change, it's not quite as much an issue. To me, the disconcerting thing
is that there's no indication the compiler <has> to do it the same for
all instances, so it is possible (albeit, unlikely, I tend to agree)
that behavior might depend on other things such as what code is in a
For...Next loop, for example. That's the worst possible scenario. But,
since it isn't defined, I don't rely on the behavior--if I would want
the loop index after a loop, I'd save a temporary just to make sure...
I note there is a recommendation <against> changing the loop variable
value in a For loop, but only as an admonition as to making for
occasional hard to debug behavior, not as illegal.
- Next message: Duane Bozarth: "Re: Can not compile"
- Previous message: Randy Birch: "Re: Using Wildcards in a Select Case Statement ?"
- In reply to: Bob O`Bob: "Re: Using Wildcards in a Select Case Statement ?"
- Next in thread: Gale Green: "Re: Using Wildcards in a Select Case Statement ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|