Hi Barbara -

On Fri, 08 Feb 2008 12:27:41 -0500, Barbara Morris
<bmorris@xxxxxxxxxx> wrote:

If a variable is
local, the checking is limited to that procedure; if global, the
checking needs to be done for the whole module; if exported from a
module in a program, the checking needs to be done for the whole
program; if exported from a service program, the checking needs to be
done for the whole system.

All other global variables have to be checked for the whole module, so
I don't see the need to jump through hoops to protect the few
variables that I would have as local static variables if I didn't have
to jump through hoops. The vast majority of my global variables in
service programs need to be available to multiple procedures anyway.

As for exporting, personally I *never* export variables, only
procedures. If a caller needs to be able to read the variable apart
from any other kind of action, I provide a "get" procedure which
returns the variable's value. If a caller needs to be able to change
it explicitly, I would provide a "put" procedure. So the variable is
protected from random changes from the outside world except through
the defined interfaces.

I do have "get" procedures in many of my service program. At the
moment I can't think of a straight "put" procedures in any of my
service programs, though I know I have one as an internal procedure in
a regular program.

Ken
Opinions expressed are my own and do not necessarily represent the views
of my employer or anyone in their right mind.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.