_ Obj * _ STL_VOLATILE * _ my_free_list, _ obj _ stl_volatile

Source: Internet
Author: User

_ Obj * _ STL_VOLATILE * _ my_free_list, _ obj _ stl_volatile

I saw this sentence when I was reading the second level of the Space configurator in STL source code analysis. I was a bit puzzled, So I thought about it after reading it:

Obj is followed by a pointer STL_VOLATILE. It should also be a type definition, and define should be included in the program to define it. So it is the pointer ..

Pointer, that is, the address, SO _ my_free_list is an address, and * _ my_free_list points to the variable value of the storage zone where _ my_free_list is the address. The value of _ STL_VOLATILE * _ my_free_list is also an address, * _ STL_VOLATILE * _ my_free_list points to the value of the variable in the storage zone where _ STL_VOLATILE * _ my_free_list is the address _ my_free_list.

For example, use A to replace _ my_free_list, and use B to replace _ STL_VOLATILE * _ my_free_list.

That is, A is an address, B is also an address, and the data stored in the address A is also an address. Simply put, the address is called C, in this case, the bucket where the address C is located stores A variable. * A points to this variable;

The address B is also an address, and the address is an address. The address is not someone else, it is, * B is equal to C (C is the data stored in the address ).

_ Obj * _ STL_VOLATILE * _ my_free_list? _ Obj is a type, followed by a pointer?

Well, yes. Obj is followed by a pointer STL_VOLATILE. It should also be a type definition, and define should be included in the program to define it. So it is the pointer ..

Pointer, that is, the address, SO _ my_free_list is an address, and * _ my_free_list points to the variable value of the storage zone where _ my_free_list is the address. The value of _ STL_VOLATILE * _ my_free_list is also an address, * _ STL_VOLATILE * _ my_free_list points to the value of the variable in the storage zone where _ STL_VOLATILE * _ my_free_list is the address _ my_free_list.

For example, use A to replace _ my_free_list, and use B to replace _ STL_VOLATILE * _ my_free_list.

That is, A is an address, B is also an address, and the data stored in the address A is also an address. Simply put, the address is called C, in this case, the bucket where the address C is located stores A variable. * A points to this variable;

The address B is also an address, and the address is an address. The address is not someone else, it is, * B is equal to C (C is the data stored in the address ).

I understand your problem in this way and hope you can understand it.
 
# Define outp_w (addr, dat) * (volatile UINT32 *) (addr) = dat;

# Define outp_w (addr, dat) * (volatile UINT32 *) (addr) = dat;
Equivalent
# Define outp_w (addr, dat) * (volatile UINT32 *) addr) = dat;
(Volatile UINT32 *) addr converts addr to a variant pointer
* (Volatile UINT32 *) addr) is used to modify the value indicated by the pointer.
It's actually a macro.

Volatile
Volatile declarator

The volatile keyword is a type qualifier used to declare that an object can be modified in the program by something other than statements, such as the operating system, the hardware, or a concurrently executing thread.

The following example declares a volatile integer nVint whose value can be modified by external processes:

Int volatile nVint;
Objects declared as volatile are not used in optimizations because their value can change at any time. the system always reads the current value of a volatile object at the point it is requested, even if the previous instruction asked for a value from the same object. also, the value of the object is written immediately on assignment.

One use of the volatile qualifier is to provide access to memory locations used by asynchronous processes such as interrupt handlers.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.