| | Re: Are there GOTO statements in NQC?
|
|
(...) The thing everyone has forgotton about the "one exit point" rule is that it applies to MACHINE CODE PROGRAMMING - not high level languages. This single misunderstanding has resulted in more convoluted and illegible code than I care to (...) (21 years ago, 20-Nov-03, to lugnet.robotics)
|
|
| | Re: Are there GOTO statements in NQC?
|
|
(...) This exact same argument can be applied to high-level languages where you dynamically allocate memory or other resources that need to be released before leaving the function. While I agree that forcing people to have only one exit point at all (...) (21 years ago, 20-Nov-03, to lugnet.robotics)
|
|
| | Re: Are there GOTO statements in NQC?
|
|
(...) Which is why we have C++. With memory constructors and destructors, quite complex resources can be automatically and cleanly free'd up on exit from a function. ---...--- Steve Baker ---...--- HomeEmail: <sjbaker1@airmail.net> WorkEmail: (...) (21 years ago, 20-Nov-03, to lugnet.robotics)
|
|
| | Re: Are there GOTO statements in NQC?
|
|
(...) *snicker* I'm surprised you used C as one of your example languages, then. Anyway, not all of us are so lucky as to be able to choose a language where you can hide all your cleanup code like that. As a personal issue, I find such cleanup (...) (21 years ago, 21-Nov-03, to lugnet.robotics)
|
|
| | Re: Are there GOTO statements in NQC?
|
|
Don't know about C/C++, but IIRC in Java the garbage collector destroys objects not when they are out of scope, nor when their creator function exits. It destroys them when the object is no longer referenced by any threads. That is to say, if (...) (21 years ago, 21-Nov-03, to lugnet.robotics)
|
|
| | Re: Are there GOTO statements in NQC?
|
|
(...) The purpose of garbage collection is to remove resources from use when they are not going to be used anymore. It covers a variety of issues, some you've each touched on. I suggest as a start, Garbage Collection: Algorithms for automatic (...) (21 years ago, 21-Nov-03, to lugnet.robotics)
|
|
| | Re: Are there GOTO statements in NQC?
|
|
(...) Actually, this is a common misconception. In Java, there is no guarantee that memory is _ever_ reclaimed. It is perfectly permissible by the specification (and quite common in embedded applications) that garbage collection is _never_ done. At (...) (21 years ago, 21-Nov-03, to lugnet.robotics)
|