See a function defined as follows: #include "u.h" #include "lib.h" ulong getcallerpc (void *x) {return (((ulong*) (x)) [-1]);} ((ulong*) (x)) to cast the void* X-pin to ulong*
You can now understand that X points to an array of ulong types
[-1]: Indicates the element to go before X
The code above is equivalent to the
ULONG px= (ulong*) x
--px
Return (*PX)
In general, the following table-1 is not used, and it is estimated that there is any special usage here, which depends on how it is actually used.
In ((ulong*) (x)) [-1]:
X is a pointer
(ulong*) (x): Converts an X to a ulong type pointer, and we assume that (ulong*) (x) after conversion, the pointer is Y, then
((ulong*) (x)) [-1] is: y[-1], and y[-1] points to the address in front of the first address of Y. This situation is only
When you know what the address is, that's the special usage upstairs. ~_~
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.