× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Murphy, Mark wrote:
No, local variables do not make the code more bug prone because they are only applicable to the
subprocedure, and since a subprocedure only does a single thing, it isn't all that big. Therefore, a
subprocedure isn't terribly hard to read and understand. And since a subprocedure only does a single
thing, and has no side-effects, it is easy to reuse wherever it is needed; just like a BIF.


One gotcha with local variables: If you have procedure in a module with a global file, and the procedure does a READ or WRITE without a result data structure, then the I/O operation will use the global fields on the I or O specs. If you have defined local fields with the same names as the global fields, your procedure won't be able to see the values of the changed fields from the READ, or the unchanged global fields' values will get written out to the file.

Moral: If you want to do I/O to a global file in a procedure, don't define local variables with the same names as fields that appear on any I or O specs (in the compile listing).


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.