In C, the static keyword can be used in the global range, function range, or local range!
First ExperimentCode:
# Include
The code output is as follows:
The execution result shows that the static variable J defined in IF is independent from the static variable J
This article describes some issues related to local code compilation in Java. Dynamic (Real-Time) compilation or static (early) Compilation cannot meet the requirements of all Java applications. The authors compared the two compilation technologies in various execution environments and demonstrated how they complement each other.
The performance of Java applications has become a hot topic in the developmen
JNI/NDK Development Guide (6) -- C/C ++ access Java instance methods and static methods, jnindk
Reprinted please indicate the source: http://blog.csdn.net/xyang81/article/details/42582213
In the previous five chapters, we learned how to use the JNI function to access the basic data types, strings, and arrays in the JVM. Next, we will learn how the local
associated with call graph edge.
createnewchild (t, M ', label (e)): Creates a new tree node attached to, and the link is tagged as.
To avoid infeasible chain, this approach use a simple test:for any call through this, the receiver class associated with E should match the receiver class associated with the last edge in chain.
use-backedges: Creating a Back-edge from a tree node to some ancestor of this node. In addition, if use-backedges is true, we have an
Article Title: analysis and use of static link libraries in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
At the C language level, code reuse is usually implemented through
the variable is visible. This is the difference between it and the global variable. From the above analysis, it can be seen that changing the local variable to a static variable changes its storage mode, which changes its life time. Changing a global variable to a static variable changes its scope and limits its scope of use. So the function of the
Static Keywords of C ++
The static function of C ++ has two usage methods: static in process-oriented programming and static in object-oriented programming. The former applies to common variables and functions, and does not invol
) {person P=NewPerson (); Person P1=NewPerson ("LiSi", 23); }}Static code block:Characteristics:1. Executes as the class loads, and only once.2. Takes precedence over the main function execution.Function: initializes the class.When the methods in the class are statically, and the construction method is private, it is not possible for us to instantiate this class, but to let the class add some properties, we
();//4--> directly executes the subclass method 5 } c c = new C (); 2--> {System.out.println ("222");} void Speak () { System.out.println ("a");} } Class c{ C () { System.out.println ("C")
, which is why the static code block is called only once when the class is used. In other cases, the static code block is not called.
Let's use javap disassembly.
Public class Student {static {System. out. println ("first constructed co
A static
1) Background
Cause: when the program executes the variable defined in the function to its definition, the compiler allocates space for it on the stack, the space allocated by the function on the stack is released at the end of the function execution. This creates a problem: If you want to save the value of this variable in the function to the next call, how to implement it?
The easiest way to think of is to define a global variable, but defi
are not very different. All methods, whether static or instance, are allocated memory when the class is JIT-loaded, and the static method is referenced by the class name, and the instance method refers to the object instance. When an instance is created, no memory is allocated for the method of the class, and all instance objects share the method code of a class
advantages, first, regardless of how many deposit objects are defined, the interest data members share the memory allocated in the global area, so save storage space. Second, once the interest needs to change, as soon as the change is made, the interest of all the deposit objects changes over, because they are actually sharing one thing.
Static member functionsFeatures: A, static member functions are
Static
I. backgroundCause: when the program executes the variable defined in the function to its definition, the compiler allocates space for it on the stack, the space allocated by the function on the stack is released at the end of the function execution. This creates a problem: If you want to save the value of this variable in the function to the next call, how to implement it?The easiest way to think of is to define a global variable, but defining
essentially usedarCommand Packaging.oFile. We can even usearPackage some files at will:
$ echo 'hello' > a.txt echo 'world' > b.txt$ ar -r test.a a.txt b.txt$ cat test.a!Link Process
When the linker links to a static library.oSimilar. The link process can be summarized as follows:
Summary:
All.oWill be linked to the final executable program; Link.oThe.oInglobal symbolAndunresolved symbolPut in a temporary table
If multiple.oThe sameglobal symbol
. For example, if the developer wants to know whether printf () is defined in the hello Library mentioned above ():
$ Nm libhello. so | grep printf U
The printf u ing symbol printf is referenced but not defined in the function. It can be inferred that to use the hello library normally, it must be supported by other libraries, run the ldd command to check which libraries hello depends on:
$ Ldd hello libc. so.6 =>/lib/libc. so.6 (0x400la000)/lib/ld-linux.so.2 =>/lib/ld-linux.so.2 (0x40000000) fro
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.