Gene, I dont know, but sometimes Cprogrammers designing a new (linuxcnc) language seem to be infected by C rules.
So K&R says that the scope of a variable does not extend outside the block where it is defined (read: first assigned to, in this case) Now a compound statement (a sequence of statements) under an if, else, for, while, do, etc. construct is such a block. Quite logical really, beause who says that the program willl follow the exact path through the block where you first defined your variable. so better safe than sorry and the variable goes up in smoke as soon as you leave such a block. AND if there was a variable with the same name before you entered this block, that var will come back alive. while inside the block it was in hybernation, because you called a new variable with the same name into being, by assigning to it. j. On Thu, Mar 8, 2012 at 1:22 AM, gene heskett <ghesk...@wdtv.com> wrote: > On Wednesday, March 07, 2012 06:16:33 PM Mark Wendt did opine: > > > On 03/07/2012 08:22 AM, gene heskett wrote: > > > See my previous msg Karl, I believe I have it working. But its too > > > cold in the shop to expect vactra to act warm enough for the > > > feedrates, so all I am doing ATM is cutting virtual air. ;) > > > > > > Thanks. > > > > > > As for this problem, from the clues I'm picking up here, if a global > > > variable is created/adjusted inside of an onumber while, its gone when > > > the corresponding onumber endwhile is finished. That is the only > > > conclusion I can come to that fits the observed results. > > > > > > IMO, if its defined globally, as in #<_name>, even if its inside a > > > "while/endwhile" then it s/b globally usable. Such seems not to be > > > the case. So it seems to be at odds with the docs in this regard. > > > Fixing that, could even fix the exit crashing I'm getting maybe? As > > > in a screwed up stack? > > > > > > Cheers, Gene > > > > Gene, > > > > How are you returning the value of the global variable after you exit > > the loop? Perhaps you need an assignment statement prior to the exit of > > the loop to ensure you are returning the value you want? Crazy things > > can happen inside those things to global variables. > > > > mark > > I had been assuming that it was whatever it was inside the loop, when the > loop fell through. That didn't turn out to be overly reliable as it was > often the same value as before the loop, even if it had been modified 360k > times inside the loop. > > Cheers, Gene > -- > "There are four boxes to be used in defense of liberty: > soap, ballot, jury, and ammo. Please use in that order." > -Ed Howdershelt (Author) > My web page: <http://coyoteden.dyndns-free.com:85/gene> > mummy, n.: > An Egyptian who was pressed for time. > > > ------------------------------------------------------------------------------ > Virtualization & Cloud Management Using Capacity Planning > Cloud computing makes use of virtualization - but cloud computing > also focuses on allowing computing to be delivered as a service. > http://www.accelacomm.com/jaw/sfnl/114/51521223/ > _______________________________________________ > Emc-users mailing list > Emc-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/emc-users > ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users