TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALEXANDRE OSTANINE
from: WIM VELDHUIS
date: 1997-04-07 22:10:00
subject: Static?

Alexandre Ostanine wrote in a message to Wim Veldhuis:
WV>When static is used within a class declaration, it signals that the
WV>method or attribute is class global. This means that the attribute is
WV>shared between all instances of the class, and even exists when no
WV>instance is created. For methods its means that the method is not called
WV>on an instance, thus the method has no access to none static members,
WV>other than addressing them somehow over another instance.
 AO> Bye,
 AO>    Can't you UNDERSTAND english word "static" ? 
 AO>  
 AO>     Static is Static. It exist allways,even if you exit
 AO> function where it      declared and the value is not
 AO> changed. So next time you can use it again. 
First of all, I am dutch. This means not all english words are clear to me. 
However, I do tend to think I am quite good in english and I think I 
understand the english word STATIC. (Dutch: A=> statisch, gelijkblijvend, in 
rust, van het evenwicht; => atmosferische storing). The dutch translations 
however do not give the meaning of the keyword static as it is used in the C 
and C++ programming language.
If you reread the alinea quoted above, you'll see that I do understand what 
the word static means in the context of C++.
If you declare a static and a not-static method in a class, BOTH methods will 
exist allways. So this cannot be the meaning of static in this case. There 
are however side-effects as to how and when to call the functions depending 
on them being static or not. A static declared member function can be called 
both with and without an instance of the class. A normal member function 
(i.e. not static) can only be called on an instance of the class.
This is what the thread was about (partly at least) and what I tried to 
explain.
If you look at global variables, the word static only limits the visibility 
of the variable. A static declared variable is only visible in the module in 
which it is declared. Both variables exist during the whole lifetime of the 
application. The static declared variable has what is called internal 
linkage. The other variable has external linkage, meaning that is can be 
accessed from all modules of the application. Here again we see that what 
static does in C/C++ is different from what the english word STATIC does 
imply.
As usual there is more to a word than only its meaning. Words can only be 
understood correctly when they are seen in the context in which they are used 
!
P.S. The third use of static, which is when static is used in a variable 
definition inside a function, where static indeed does mean what you said. In 
my opinion, one out of three is a very bad score.
mvg/wr
  
--- timEd/2 1.01.g3+
---------------
* Origin: LightHouse BBS ==> I am a H.U.G.O. Member ! (2:285/324.3)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.