"Daniel" Daniel gives pointers, extremely difficult

Source: Internet
Author: User

Has anyone ever done an iOS program?
"Issue" 2015/7/3 14:29:49
typedef struct t{Union {struct t* (*v) (const *[]); const * const r;};} const* (* (* (* (*V) [1]) [1]) (struct {const C;} * (*) (struct T *[]))) (const[]);
int main ()
{return 0;}
"Nagging" Little six sons 2015/7/3 15:55:57
This code should not be complete.
Or that's not right.
"Spit Groove" "Daniel" 2015/7/3 20:33:56
? What's wrong?

"Spit Groove" "Daniel" 2015/7/3 20:35:21
is to define a type that points to a pointer to an array of elements as V ...
"Nagging" Little six sons 2015/7/3 20:37:00
Still haven't read it.
"Nagging" Little six sons 2015/7/3 20:39:37
Why did you learn so long C, also read a book, this is a broken pointer or play not turn ...
"Spit Groove" "Daniel" 2015/7/3 20:40:35
...... This skill is very simple ah, more good

"Spit Groove" "Daniel" 2015/7/3 20:40:58
Oh, yes
"Nagging" Little six sons 2015/7/3 20:41:11
I do not understand the main normal, how to write Ah
He doesn't understand this piece of code.

"Spit Groove" "Daniel" 2015/7/3 20:41:41
This code is very complicated, I'm at a friend's house, I go back to teach you how to see and how to organize the adult to understand the format
"Nagging" Little six sons 2015/7/3 20:41:54
Oh, yes.
Good

"Spit Groove" "Daniel" 2015/7/4 1:45:54
typedef struct t{Union {struct t* (*v) (const *[]);
const * Const R; };} const* (* (* (* (*V) [1]) [1]) (struct
{const C;} * (*) (struct T *[]))) (const[]);

It's too complicated, so what? First, we find the first word, the struct, the language of the struct.
Method: struct Name {...}, define this first:
typedef struct T {
Union {
struct t* (*v) (const *[]);
const * Const R;
};
} Type1;

Change in:
typedef Type1 CONST* (* (* (* (*V) [1]) [1]) (struct
{const C;} * (*) (struct T *[]))) (const[]);

Then the next parenthesis is (), and we'll ignore the parentheses and see what's out there?
typedef Type1 const* (...) (const[]);

is a function, define:
typedef Type1 const* Type2 (const[]);

Change in:
typedef type2* (* (* (*V) [1]) [1]) (struct {const C;} * (*) (struct T *[]));

The same approach:
typedef type2* (TYPE3) (struct {const C;} * (*) (struct T *[]));
typedef type3* (* (*V) [1]) [1];

typedef type3* TYPE4[1];
typedef type4* ((*V) [1]);

typedef type4* TYPE5[1];
typedef type5* V;

Tidy up and use the same method to bring up any complex part:
typedef struct T* Type1_func (const *[]);
typedef struct T {
Union {
Type1_func* v;
const * Const R;
};
} Type1;
typedef Type1 const* Type2 (const[]);
typedef struct {const C;} Type3_arg_ret;
typedef struct T *type3_arg_arg;
typedef type3_arg_ret* TYPE3_ARG (type3_arg_arg*);
typedef type2* (TYPE3) (type3_arg*);
typedef type3* TYPE4[1];
typedef type4* TYPE5[1];
typedef type5* V;

Then look down from the top:
1. V is a type (typedef)
2. This type is a pointer to another type TYPE5
3. Type5 is an array with only one element, and the type is a pointer to Type4.
4. Type4 is an array with only one element, and the type is a pointer to Type3.
5. Type3 is a function that returns a pointer to Type2
-its argument is a pointer to the TYPE3_ARG type.
6. Type3_arg is a function
-This function returns a pointer to Type3_arg_ret
-Accepts a pointer to the type of type3_arg_arg.
7. Type3_arg_ret is a structural body
-there is only one INT member C that cannot be changed in the struct (the default is int without a write type).
8. Type3_arg_arg is a pointer
-point to struct t (struct t exactly what we don't know yet, so called incomplete type).
9. Type2 is a function
-This function returns a pointer to a TYPE1 type that cannot be changed
-Accepts a pointer to an int type that cannot be changed (pointing to an array, but not forcing) as a parameter.
The Type1 type is a structural body
-This struct is also called struct T (now struct T is not an incomplete type!) )
-struct T struct has only one anonymous union as a member (this is not standard!) But many compile periods are supported)
-This anonymous union has two members
-It can be a pointer to a type1_func of type V
-The Type1_func type is a function
-it returns a pointer to the struct-body t
-Accepts a pointer to an array (not mandatory) as a parameter
-Each element of this array is a pointer to a variable of type int that cannot be changed.
-can also be immutable, pointing to a pointer to an int type that cannot be changed r


int main ()
{return 0;}

"Spit Groove" "Daniel" 2015/7/4 1:49:24
1. Look up from the bottom up
2. This is obviously not a practical example, it is the complexity of the declaration of sporogenous that embodies C
3. However, this also embodies the superiority of the statement of C: a very short expression can express a very rich concept
4. However, it is reasonable to leave these concepts in a meaningful way
5. Finally, it is to be noted that this is a statement of C89 that is not in conformity with the standard, as reflected in:
5.1 The usage of the omitted int was abolished in the C99
5.2 Any C language standard does not allow anonymous federation to appear, which is a compiler extension, although both VCs and GCC support this extension.
I'm done.
"Nagging" Little six sons 2015/7/4 7:14:38
Oh, yesterday was a bit tired, waiting to wait and then went to sleep

"Daniel" Daniel gives pointers, extremely difficult

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.