C #4.0 opening of syntactic sugar,

Source: Internet
Author: User

C #4.0 opening of syntactic sugar,

Although I am not a computer student, I still have a passion for the IT industry. I have been in the IT industry for more than three years, I fell in love with it after I learned about it on the Internet last year. Many cool people read their code, which makes me feel something in my mind, there are also a lot of things to learn at ordinary times, so sometimes it is easy to forget it after learning it for a while, so I want to write articles in my heart, so I can summarize my knowledge, second, I can look back after a while, but I have never started because of my work, and I am also lazy. Today I decided to start recording every bit of work in my study, I am also a newbie, so if you see it, you can forgive me and take it for a long time!

I don't need to talk much about it. I started with the C # syntax at the beginning, but it is probably useless to talk about the most basic. So today I will start with the C #4.0 syntax!

    Overview:The syntactic sugar is also translated into sugar-coated syntax by Peter J. A term invented by Landin refers to a syntax added to a computer language. This syntax does not affect the functions of the language, but is more convenient for programmers. In general, the use of syntactic sugar can increase the readability of the program, thus reducing the chance of program code errors.

What needs to be declared is that the word "syntactic sugar" is not a negative term, it can bring convenience to me, it is a convenient way of writing, the compiler will help us do the conversion; in addition, it can improve the development coding efficiency and won't cause any loss in performance. Therefore, developers like it very much. It is very sweet.

In the early days of compiler development, compiler scientists have been trying to optimize the code generated by the compiler. At this time, the compiler mainly optimizes the machine because the time of the machine was very valuable, machine computing speed is not fast. Today we have enough good machines (but it doesn't mean that we can write programs with no focus on performance), and as a programmer, the time is much more precious than the machine, so today's compilers are also being optimized. From the development of programming languages, today's programming languages are more advanced than yesterday's, it is also more user-friendly. We only need to write less code, more human-thinking code, but only focus on the focus of our values. Give it to the compiler for physical work.

On the first day of today, I will show the overall structure of the C #4.0 syntactic sugar that I intend to record with a graph:

Today, we will share with you a plan to explain the syntactic sugar and solutions to problems encountered in future work or study, hope to help you. For the first time I wrote an article, please forgive me and ask me to pay attention to me and provide valuable comments!

The original Article is from: www.yaosutu.cn/archives/545


In the C language, what is the symbol (->) and how to use it?

This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.

In the C language, what is the symbol (->) and how to use it?

This is a symbol in the struct pointer. Write a program to explain it, for example:
# Include <stdio. h>
Struct STU // define a struct
{
Int num;
} Stu;
Int main ()
{
Struct STU * p; // defines a struct pointer.
P = stu; // p points to the struct variable stu.
Stu. num = 100; // attaches an initial value to the struct member num.
Printf ("% d", p-> num); // output the num value in stu
Return;
}
As you can see, the-> method is to reference the variable in the struct !!
Format: p-> struct member (such as p-> num)
The function is equivalent to stu. num or (* p). num.
I don't know. You don't understand, and don't understand call me. O (∩ _ ∩) O ~
Hope to adopt it.

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.