× 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.


  • Subject: Re: the word 'static'
  • From: Jim Langston <jimlangston@xxxxxxxxxxxxxxxx>
  • Date: Fri, 01 Jun 2001 15:27:58 -0700
  • Organization: Pacer International

Static Variable: A variable that retains it's value.
Constant Variable: A variable that's value can not be changed.

The word Static comes from the original core memory that computers had.
It used a static charge, and would keep this charge when power was removed.

On some of the original computers there was a game that was installed and
ran before the machine was disassembled and shipped to it's new location.
Once everything was put back together the game would resume where it left
off, ensuring that everything was working. (Read in the book "Hackers")

So, what how does that apply to a Static variable?  Once the "power" is shut
off from your subroutine (it returns) the variable keeps it's value.  When
the subroutine is returned to the variable will have the same value.

If you do not declare your variables as static, then the next time the 
subroutine is called the variables will be re-initialized.

Regards,

Jim Langston

Me transmitte sursum, Caledoni!

Patrick Conner wrote:
> 
> Why are they called static varibles when the value can
> change? :)
> 
> In a subprocedure I have to reset file variables that I want
> reset upon reentry even when I am controlling the opening
> and closing of the file. Right?
> 
> The variable values are in memory and have nothing to do
> with or not the file is open. Correct?
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.