Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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
Hooray!


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://317590]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2014-08-01 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (18 votes), past polls