Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Re: Re: Re: Re: for loop localisation bug?

by BrowserUk (Pope)
on Dec 30, 2003 at 00:15 UTC ( #317590=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: Re: for loop localisation bug?
in thread for loop localisation bug?

I said my Pascal was a long time ago:) I dug up a little info on the last Pascal compiler I used -- in a museum!

For C, I think the info I dug up and posted here is reasonably definitive. With deference to MADuran's info on C99 which I've never encountered, there is no definitive statement on the state of a C for loop variable after a for loop, simply because there is nothing special about a for loop variable in C.

  • It is simply a variable that has a scope defined by the block in which it is declared.
  • It must have been declared before it can be used in the for loop.
  • Any modifications made to it, either by the control statements or within the for loop body, persist after the for loop terminates, and until it goes out of scope.
  • It remains in scope, until the block it was defined in, ends.

One all. Now lets get back to perl:)

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

  • Comment on Re: Re: Re: Re: Re: for loop localisation bug?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://317590]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-03-18 19:55 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (230 votes). Check out past polls.