DECLARE GLOBAL / EXTERN

GCC Consulting gccconsulting at comcast.net
Sat Jul 28 09:10:28 PDT 2007


 

> -----Original Message-----
> From: 
> filepro-list-bounces+gccconsulting=comcast.net at lists.celestial
> .com 
> [mailto:filepro-list-bounces+gccconsulting=comcast.net at lists.c
> elestial.com] On Behalf Of Bruce Easton
> Sent: Friday, July 27, 2007 2:14 PM
> To: Filepro_List
> Subject: RE: DECLARE GLOBAL / EXTERN
> 
> Kenneth Brody wrote Friday, July 27, 2007 1:42 PM:
> [..]
> > 
> > Note that it is perfectly acceptable to have DECLARE EXTERN in the 
> > main processing, and DECLARE GLOBAL in the CALLed table, as long as 
> > you don't use the variable until you call the table that actually 
> > defines it with the DECLARE GLOBAL.  I do this all the time.
> >
> 
> Now he tells us :):)  You probably did say this before, but I 
> missed this ability completely.
> 
> [..]
> 
> > 
> > In more complex library scenarios, I often have an "init" 
> table with 
> > all of the DECLARE GLOBALs needed by the library, in 
> addition to any 
> > required initializations, which gets called prior to using 
> any of the 
> > library routines themselves.
> > 
> 
> And that's probably why.  I'm in a habit of declaring long 
> vars at the top of the main table with edit, len, etc.
> 
> But it seems to me that if your main use of a particular 
> declared variable (especially if it is only set and changed) 
> is in a called table, and, like you say, you don't need to 
> reference it prior to the call, then it would be more useful 
> to have the full declaration in the called table as well for 
> easy reference.  
> In either case, declaring with EXTERN begs the programmer to 
> put some kind of comment about the field where I try mention 
> the length, edit, purpose.
> 
> 
> Bruce
> 
> Bruce Easton
> STN, Inc. 
Although some programmers are not using the auto table, this is a good place
to declare global variables as it then allows for this variable to be used
in all processing tables for that file.

Also, in many cases, when declaring long variables that are related to a
real field in the file, I'll use
Declare foobar(len(xx),edit(xx)).  This will keep me from having to change
this variable is I need to change the associated field size.

Richard Kreiss
GCC Consulting
 




More information about the Filepro-list mailing list