A Concise Guide for Go Programmers to Embrace C

Permalink to this article – https://ift.tt/DHrXwW3

This article is a snack article “Tony Bai: A Concise Guide for Go Programmers to Embrace C Language” for Yu Hang’s geek time column “In-depth C Language and Program Operation Principles” , which is shared here for everyone, especially those who want to learn C Language Gophers.


Hello, my name is Tony Bai.

Maybe some of my classmates are more familiar with me, and have read my column “Tony Bai · Go Language First Lesson” on Geek Time, or have followed my blog . So, as a Gopher, how did I come to this C language column to share it? In fact, before learning Go language and becoming a Go programmer, I was also a real C programmer.

After graduating from university, I started working on C language back-end service development, and worked hard in the telecom value-added field for more than ten years. If you don’t believe me, you can go to my blog and count whether there are more C-related articles than Go. It was only in the last few years that I switched the main language of my work from C to Go. But this is not a C language problem, the main reason is that I switched tracks. I am currently engaged in the advanced research and development of cloud-native platforms in the field of intelligent connected vehicles, and in terms of cloud-native, the new generation of Go language has a better ecology.

However, as a senior C programmer, the C language has left a deep imprint on me. Although Go is the main language I currently work in, I still read the source code of some C open source projects every day and write hundreds of lines of C code every week. In some work scenarios, especially when I participated in the development of some vehicle-side middleware first, the C language has the advantages of small resource consumption and high performance, which is currently unmatched by Go.

Just because I have dual identities as a C programmer and a Go programmer, when I received this invitation to add a meal, I thought of a very suitable topic to talk about – between Gopher (generally referring to Go programmers) and the C language” Matchmaking”. In the comment section of this course, I saw some students say, “It is because I learned Go that I want to learn C well”. If you are also familiar with Go, then congratulations, this snack is tailor-made for you: the problems that a programmer familiar with Go needs to pay attention to when learning C, and the pits that may be encountered, I It’s all summed up for you.

Of course, I know there are some students who don’t know much about Go, so don’t rush to quit when you see this. Because the comparison between C and Go is an interesting topic in itself. Today’s snack will involve the similarities and differences between the two languages. By comparing the features of C and Go, you can better understand “why the C language is designed as it is now”.

1. C language is the foundation of modern IT industry

Before comparing C and Go, let’s talk about the most important reason why I recommend Gopher to learn C: To sum up in one sentence, the foundational position of C language in the IT industry is unshakable by Go and other languages .

C language is a high-level programming language created by Dennis Ritchie of Bell Labs in the United States based on the B language designed by Unix inventor Ken Thompson. It was born in the last century (1972 to be precise), and this year (2022) has reached the half-century of “knowing the destiny”. Old age and long-term design have always been the source of the rise of “C obsolescence”, but if you believe this statement, you are dead wrong. Now, let me analyze the next reason for you.

First, let’s talk about the C language itself: The C language has been evolving and has never stopped .

Although Dennis Ritchie, the father of C language, unfortunately left us forever in 2011, C language has long since become an ANSI (American National Standards Institute) standard as well as an ISO/IEC (International Organization for Standardization and International Electrotechnical Commission) standard, so its evolution It has long been the responsibility of the Standards Committee. Let’s briefly review the evolution of the C language standard:

  • In 1989, ANSI released the first C language standard, known as C89, also known as ANSI C. The following year, ISO and IEC designated the ANSI C89 standard as the international standard for the C language (ISO/IEC 9899:1990), also known as C90, which is also the first official version of the C language;
  • In 1999, ISO and IEC released the C99 standard (ISO/IEC 9899:1999) , which is the second official version of the C language;
  • In 2011, ISO and IEC released the C11 standard (ISO/IEC 9899:2011) , which is the third official version of the C language;
  • In 2018, ISO and IEC published the C18 standard (ISO/IEC 9899:2018) , which is the fourth official version of the C language.

    Currently, the ISO/IEC standardization committee is working on the improvement and development of the C2x standard, which is expected to be released in 2023.

Second, the C language is still very popular today .

The data of the famous programming language ranking list TIOBE shows that the total ranking of the annual average rankings of major programming languages, C language has been the first for many years, as shown in the following figure (picture from TIOBE ):

This shows that, both in the past and now, C language is a widely used industrial-level programming language.

Finally, and the most important point is: C language is the foundation of modern IT industry , it is not an exaggeration to say that C will never withdraw from the stage of IT industry.

Today, whether it is Windows, macOS, Android, Apple iOS on the ordinary consumer side, or Linux, Unix and other operating systems on the server side, or operating systems in various industrial embedded fields, the kernel implementation language is C language. The mainstream web servers used in the Internet era, such as Nginx, Apache, and mainstream databases, such as MySQL, Oracle, PostgreSQL, etc., are also masterpieces developed in C language. It can be said that modern humans are in close contact with the systems implemented by the C language every day, and have been inseparable from these systems. Back to the daily life of our programmers, the source code version control software we use at all times, such as Git and SVN, are also implemented by the C language.

It can be said that the fundamental position of the C language in the IT industry cannot be replaced not only by the Go language, but also by system programming languages ​​such as C++ and Rust, not only in the short term, but also in the long term.

In short, C language has excellent features such as compactness, high efficiency, good portability, and fine control of memory, which makes it not out of date for us to learn it at any time. However, I recommend Gopher here to understand and systematically learn the C language for another reason. Let’s continue reading.

2. Similarities between C and Go: Gopher embraces the “innate advantages” of the C language

As we all know, Go is derived from the C language, and there are many similarities between the two, so Gopher has an “innate advantage” when learning the C language. Next, let’s take a look at what C and Go have in common.

1. Simple and syntactically homologous

The Go language is known for its simplicity, and the C language, which is the ancestor of Go , also has a low entry barrier: Go has 25 keywords, C has 32 keywords (C89 standard), and the level of simplicity is comparable. C language has long been the preferred programming language for computer programming education in colleges and universities, which is not unrelated to the simplicity of C.

Different from Go, C language is a programming language with small kernel and large extension , and its simplicity is mainly reflected in the small kernel. This “little kernel” includes the basic C syntax and its standard library, which we can quickly grasp. But it should be noted that, unlike the “out-of-the-box and rich” standard library of the Go language, the C standard library is very small (not even the thread library before the C11 standard), so after mastering the “small kernel”, There is no problem in writing questions on the LeetCode platform, but to write industrial-level production programs in a certain field, we still have a lot of extension knowledge and skills to learn, such as concurrency primitives, operating system system calls, and inter-process communication. Wait.

The simplicity of the C language is easy to gain the recognition of Gophers. When the fathers of the Go language designed the Go language, they also mainly borrowed the syntax of the C language. Of course, this has something to do with their strong C background: Ken Thompson, the father of Unix, co-designed the C language with Dennis Ritchie; Rob Pike was a Bell Labs A senior researcher, he participated in the evolution of the Unix system, the development of the Plan9 operating system, and the inventor of the UTF-8 encoding; Robert Griesemer is also a god-level figure who wrote Java virtual machines in C language.

The first compiler for Go was implemented in C by Ken Thompson. Also, in the early versions of the Go language, the proportion of C code was not small. Taking Go 1.0 , the first version released by the Go language, as an example, we analyze it with the loccount tool , and we will get the following results:

 $loccount . all SLOC=460992 (100.00%) LLOC=193045 in 2746 files Go SLOC=256321 (55.60%) LLOC=109763 in 1983 files C SLOC=148001 (32.10%) LLOC=73458 in 368 files HTML SLOC=25080 (5.44%) LLOC=0 in 57 files asm SLOC=10109 (2.19%) LLOC=0 in 133 files ... ...

Here we see that in version 1.0, the number of lines of code in C language accounted for 32.10%, and this share did not drop to less than 1% until Go version 1.5 implemented bootstrapping.

One of the main reasons for my “love at first sight” with Go was that Go and C have the same syntax. Correspondingly, it is believed that this homologous grammar will also make Gophers like the C language.

2. Static compilation and the same underlying paradigm

In addition to the syntactic homology, another similarity between C and Go is that they are both statically compiled languages. This means that they all have the following syntactic features:

  • Variables and functions must be declared before they can be used;
  • All allocated memory blocks must have corresponding type information, and can only be operated after the type information is determined;
  • The source code needs to be compiled and linked before it can be run.

Similar programming logic and construction process allow Gopher to learn C language seamlessly.

In addition, the underlying programming paradigms of both Go and C are imperative programming, that is, oriented to algorithmic processes, where the programmer is programmed to tell the computer what to do. The computer is then programmed to execute a series of processes that produce a specific result, much like a recipe specifies a series of steps a chef should follow when making a cake.

Looking at C from Go, there is no object-oriented, no functional programming, no generics (Go 1.18 has been added), and the eyes are full of types and functions, which can be said to be quite friendly.

3. The error handling mechanism is the same

Error handling mechanisms are very important for backend programming languages. If the error handling mechanism of the two languages ​​is different, then the overall syntax style of the code in the two languages ​​is likely to be very different.

In the C language, we usually use a function return value of type integer as the error state identifier. The function caller checks the return value representing the error state based on the value comparison method. Usually, when the return value is 0, it means that the function call is successful; when the return value is other values, it means that there is an error in the function call. The caller of the function needs to decide which code on the error processing path to execute subsequently according to the error state represented by the return value.

The simple error handling mechanism of C language based on error value comparison makes each developer have to pay attention to and handle each error explicitly. Code with explicit error handling is more robust and gives developers more confidence in the code. In addition, these errors are ordinary values, we do not need additional language mechanisms to deal with them, just use the existing language mechanisms to handle errors like other ordinary types of values. This makes the code easier to debug, and it’s easier for us to test coverage for each error-handling decision branch.

The simplicity and explicitness of the error handling mechanism of the C language is very consistent with the design philosophy of the Go language, so the designers of the Go language decided to inherit this error handling mechanism. Therefore, when Gophers came to the C world, they could easily adapt to the C style without making a big change in their error handling thinking.

3. Know yourself and the enemy, let’s see the difference between C and Go

Although Gopher has “innate advantages” in learning C language, it is impossible to master and master C language without down-to-earth learning and practice. Moreover, C and Go are still very different. Only when Gophers are clear about these differences and “know oneself and one enemy” can they distinguish the importance and focus in the learning process. As the saying goes, “Sharpening a knife does not make a mistake in chopping wood”, let’s take a look at the differences between C and Go.

1. Design philosophy

In the field of human natural linguistics, there is a well-known hypothesis – the ” Sapir-Worf hypothesis “. The content of this hypothesis is this: language influences or determines the way humans think . To me, a programming language is not just a tool either, it affects the way programmers think . Every time I start learning a new programming language, I start by understanding the design philosophy of that programming language.

Each programming language has its own design philosophy. Even if the language designer does not explicitly summarize it, it still exists and affects the subsequent evolution of the language and the language programs. members’ way of thinking. In the column “Tony Bai · Go Language First Lesson” , I summarized the design philosophy of Go language into 5 points, namely simplicity, explicitness, composition, concurrency and engineering orientation .

So what is the design philosophy of the C language? On the surface, simplicity and compactness, performance first, extreme resources, and comprehensive porting can all be used as the design philosophy of C, but I tend to have a more humanistic statement: satisfy and trust programmers .

Under this design philosophy, on the one hand, the C language provides almost all syntactic means that can help programmers express their intentions, such as macros, pointers and pointer operations, bit operations, pragma indicators, goto statements, and more jumping capabilities. For the powerful longjmp, etc.; on the other hand, the C language does not have particularly strict restrictions and constraints on the programmer’s behavior. C programmers can use these grammatical means provided by the language to perform unrestrained play: access hardware, use pointers to access Any byte in memory, manipulate every bit in any byte, etc. In short, the C language assumes that programmers know what they are doing and choose to trust programmers.

The C language gives programmers enough freedom, it can be said that in the C language world, you can almost “do whatever you want”. But this philosophy also comes at a price, and that is that you can make inexplicable mistakes, like dangling pointers, that are rarely or impossible in other languages.

Here is another metaphor to express it more vividly: from the Go world to the C world, it is like the animals that have been raised in the zoo for a long time are released into the wild nature reserve, with more freedom, but there are hidden surrounding There are many dangers that have never been encountered. Therefore, Gophers who learn C language must be mentally prepared.

2. Memory management

Next, let’s look at the differences between C and Go in terms of memory management. I put this second because there is a huge difference in memory management between the two languages, and this difference can have a huge impact on a programmer’s day-to-day coding.

As we know, Go is a static programming language with garbage collection mechanism (commonly known as GC). When programming in Go, memory allocation and release, allocation on the stack or on the heap, and the clearing of new memory blocks, etc., are all automatic and transparent to the programmer.

But in the C language, all of the above are the responsibility of the programmer. While manual memory management brings flexibility, it also brings great risks, the most common of which are memory leaks and dangling pointers.

Memory leaks mainly refer to the fact that the memory manually allocated on the heap by the programmer is not released (free) after use, and the heap memory continues to increase . The dangling pointer means that the pointer points to an illegal memory address , the uninitialized pointer, the object pointed to by the pointer has been released, etc., are the main reasons for the dangling pointer. Dereferencing a dangling pointer will result in a runtime error, which can lead to serious consequences of abnormal program exit.

Go language has GC, but C language does not have GC, which is determined by their respective language design philosophies. GC is not in line with the design philosophy of the C language, because once there is GC, programmers are far away from the machine, and the needs of programmers to face the machine cannot be satisfied. Moreover, once there is GC, it is impossible to achieve the ultimate in performance and resource usage.

What does it feel like to manage memory manually in C? As a senior C programmer with more than ten years of C development experience, I can only tell you: fighting with memory is a lot of fun ! This is not experienced in programming languages ​​with GC.

3. Grammatical Form

Although the C language is the ancestor of Go, and Go also inherits many syntax elements of the C language, there are many differences in variable/function declarations, semicolons at the end of lines, whether code blocks are enclosed in parentheses, identifier scoping, and control statement semantics, etc. There are still significant differences between the two. Therefore, programmers who are already familiar with Go often step on some “pits” due to their previous coding habits when they first learn C. Based on this, I have summarized the points that Gopher needs to pay special attention to when learning the C language. Let’s take a look at it in detail.

First, pay attention to the order of types and variable names when declaring variables

As mentioned earlier, both Go and C are statically compiled languages, which requires us to declare any variable before using it. But the variable declaration syntax adopted by Go is similar to Pascal language, that is, the variable name comes first, and the variable type comes after , which is exactly the opposite of C language, as shown below:

 Go: var a, b int var p, q *int vs. C: int a, b; int *p, *q;

In addition, Go supports short variable declarations, and because short variable declarations are shorter, there is no need to explicitly provide the variable type, the Go compiler will automatically assign the appropriate type to the variable based on the result of the initializer expression following the assignment operator. As such, it has become a favorite and heavily used syntax of Gophers. But short declarations are not legal syntax elements in C:

 int main() { a := 5; // error: expected expression printf("a = %d\n", a); }

However, like the order of variable types and variable name declarations above, the C compiler will detect and inform us of this problem without causing substantial harm to the program.

Second, note that function declarations do not need keyword prefixes

Whether it is C language or Go language, functions are basic functional logic units, and we can also say that a C program is a collection of functions . In fact, most of our daily C code writing focuses on implementing a function.

Like variables, functions need to be declared in both languages ​​before they can be used. The Go language uses the func keyword as a prefix for function declarations , and the list of function return values ​​is placed at the end of the function declaration. But in the C language, the function declaration does not need any keyword as a prefix, the function only supports a single return value, and the return value type is placed in front of the function name, as follows:

 Go: func Add(a, b int) int { return a+b } vs. C: int Add(int a, int b) { return a+b; }

Third, remember to add a semicolon at the end of the line of code

When we write Go code on a daily basis, we rarely write semicolons by hand. This is because, in order to simplify code writing and improve code readability, the Go designers chose the technical route of automatically inserting semicolons at appropriate positions by the compiler during the lexical analysis phase . If you are a Gopher spoiled by the Go compiler, when you come to the world of C language, you must not forget the semicolon at the end of the code line. For example, in the implementation of the C language Add function in the above example, remember to manually add a semicolon after the return statement.

Fourth, fill in the parentheses of “omitted”

Also for the sake of simplifying the code and increasing readability, the Go designers initially eliminated the parentheses around the conditional expressions in the conditional branch statement (if), the optional branch statement (switch) and the loop control statement (for). :

 // Go代码func f() int { return 5 } func main() { a := 1 if a == 1 { // 无需小括号包裹条件表达式fmt.Println(a) } switch b := f(); b { // 无需小括号包裹条件表达式case 4: fmt.Println("b = 4") case 5: fmt.Println("b = 5") default: fmt.Println("b = n/a") } for i := 1; i < 10; i++ { // 无需小括号包裹循环语句的循环表达式a += i } fmt.Println(a) }

This is exactly the opposite of the C language. Therefore, when we write code in C language, we must think about adding these parentheses:

 // C代码int f() { return 5; } int main() { int a = 1; if (a == 1) { // 需用小括号包裹条件表达式printf("%d\n", a); } int b = f(); switch (b) { // 需用小括号包裹条件表达式case 4: printf("b = 4\n"); break; case 5: printf("b = 5\n"); break; default: printf("b = n/a\n"); } int i = 0; for (i = 1; i < 10; i++) { // 需用小括号包裹循环语句的循环表达式a += i; } printf("%d\n", a); }

Fifth, be aware of the different mechanisms by which C and Go export symbols

The C language declares externally visible symbols through header files, so we don’t care whether the symbols are capitalized or not. But in Go, only package-level variables, constants, types, functions, and methods with capital letters are exportable, that is, visible to external packages. Conversely, the first letter in lowercase is private to the package and is only used within the package. Once Gopher is accustomed to such rules, when switching to C language, it will have “psychological sequelae”: when encountering functions with lowercase letters defined in other header files, they always think that they cannot be used directly.

Sixth, remember to add break to the switch case statement

The C language and Go language differ in the semantics of the choice branch statement: in the case statement of the C language, if the break statement is not explicitly added, the code will automatically fall down and execute. Go, on the other hand, redefines the semantics of switch cases when it was originally designed, and does not automatically fallthrough by default unless the developer explicitly uses the fallthrough keyword.

If you get used to the semantics of Go’s switch case statement and then come back to write C code, there will be potential “risks”. Let’s look at an example:

 // C代码: int main() { int a = 1; switch(a) { case 1:printf("a = 1\n"); case 2:printf("a = 2\n"); case 3:printf("a = 3\n"); default:printf("a = ?\n"); } }

This code is a switch case written in Go semantics, and the result after compiling and running is as follows:

 a = 1 a = 2 a = 3 a = ?

This is clearly not what we expected to output “a = 1”. For Gophers who are beginners in C, this problem has a great impact, because the code written in this way is completely legal in the eyes of the C compiler, but the semantics it represents are not what the developers want at all. Once such a program flows into the production environment, its defects may cause production failures.

Some Clint tools can detect such problems, so for Gophers writing C code, I recommend using a lint tool to check the code before submitting it.

4. Build Mechanisms

Both Go and C are statically compiled languages, and their source code needs to be processed by the compiler and linker. This process is called build , and the executable file obtained after the build is the final product delivered to the user.

Slightly different from the Go language, the construction of the C language also has a pre-processing stage, and the output of the pre-processing link is the real input of the C compiler. Macros in C language are expanded in the preprocessing stage. However, Go has no preprocessing stage.

The compilation unit of C language is a C source file (.c), each compilation unit will generate an object file (.o/.obj) correspondingly during the compilation process, and finally the linker links these object files together to form a executable file.

On the other hand, Go uses a package as the compilation unit. The source files in each package generate a .o file, and all the .o files of a package are aggregated (archived) into a .a file. The linker converts these targets Files are linked together to form an executable.

The Go language provides a unified Go command-line tool chain, and the Go compiler natively supports incremental builds. The source code build process does not require manual configuration by Gopher. But in the C language world, there are many tools for building C programs, the mainstream ones include gcc/clang, and C compilers for Microsoft platforms. These compilers do not natively support incremental builds. In order to improve the efficiency of project-level builds and avoid full builds every time, we usually use third-party build management tools, such as make (Makefile) or CMake. When considering portability, we also use the configure file to collect and set the environment information required by the compiler on the target machine.

5. Dependency management

I mentioned earlier that the C language only provides a “little kernel”. For things like dependency management, the C language itself does not provide a unified and relatively complete solution similar to the Go Module in Go. In the C language world, we still rely on external tools (such as CMake) to manage third-party dependencies.

Third-party dependencies of the C language usually exist in the form of static libraries (.a) or dynamic shared libraries (.so). If your application uses static linking, you must provide a third-party dependent static library file for the C compiler in the system. But in actual work, it is sometimes troublesome to fully adopt static linking. This is because many operating systems are installed without development packages by default, that is to say, system libraries such as libc and libpthread only provide dynamic shared library versions (for example, the shared library libc of libc is provided under /lib. so.6), its static library version needs to be downloaded, compiled and installed by itself (for example, the static library libc.a of libc is placed under /usr/lib after installation). Therefore , in most cases, we use a mixture of static and dynamic linking methods . For example, system libraries like libc mostly use dynamic linking.

Dynamic shared libraries are usually versioned and installed into the system according to certain rules. For example, for a dynamic shared library named libfoo, the file collection in the installed directory usually looks like this:

 2022-03-10 12:28 libfoo.so -> libfoo.so.0.0.0* 2022-03-10 12:28 libfoo.so.0 -> libfoo.so.0.0.0* 2022-03-10 12:28 libfoo.so.0.0.0*

By convention, each dynamic shared library has multiple name attributes, including real name, soname, and linker name. Let’s take a look at each.

  • real name: The name of the file that actually contains the shared library code (eg libfoo.so.0.0.0 in the above example). The real version information of the dynamic shared library is in the real name. Obviously, the version number in the real name conforms to the semantic version specification , that is, major.minor.patch. When the major numbers of the two versions are the same, it means that the two versions are backward compatible;
  • soname: short for shared object name, and the most important of the three names. The system linker uniquely identifies the shared library by the soname of the dynamic shared library (libfoo.so.0 in the above example), both at compile stage and at runtime. The soname we see is actually the shared library name that only contains the major number;
  • linker name: The name given to the compiler during the compilation phase (eg libfoo.so in the above example). If the real name of the shared library you build is similar to libfoo.so.0.0.0 in the above example, with a version number, then you cannot make the linker find the corresponding shared library by using -L path -lfoo directly in the compiler command library files, unless you provide a linker name for libfoo.so.0.0.0 (eg libfoo.so, a symlink to libfoo.so.0.0.0). The linker name is usually created manually when the shared library is installed.

    With these three name attributes, dynamic shared libraries have a basis for dependency management. However, since the linker name is used when linking, and the linker name does not carry a version number, the real version is related to the host environment, so it is still difficult to achieve reproducible construction of C applications. In practice, we usually use a dedicated build host, and the project team manages the dependencies on the host to ensure that the dependency versions used in each build are controllable. At the same time, the dependency version on the target host where the application is deployed should also be managed to avoid the problem of dynamic shared library version mismatch at runtime.

6. Code style

The Go language is the first programming language in history that has achieved a unified code style for the entire community. It basically eliminates the endless, never-ending debate among developers over coding style, and the inefficiencies in reading and maintaining other people’s code that come with different coding styles. The code style formatted by the gofmt tool has become a consensus among Go developers and has been integrated into the development culture of the Go language. So, if you ask a Go developer to talk about the code style after gofmt, most Go developers may not be able to tell, because the code will be automatically changed to that style by gofmt, and everyone no longer cares about the style. .

In the world of C, the code style is still controversial. But after years of evolution, and the constant “education” of emerging languages ​​like Go, the C community is also trying to make improvements in this area, and tools like clang-format have sprung up. At present, although there is no consensus code style in the whole community (due to historical reasons, this is difficult to achieve), but it can reduce a lot of unnecessary debate.

For Gophers who are learning C language and practicing C coding, my suggestion is: don’t stick to what code style to use, use clang-format first, and determine a set of style templates .

4. Summary

As a programmer who has followed and studied Go for nearly a decade, I have come to realize that Go’s simplicity, performance, and productivity make it an ideal language for creating user-facing applications and services. Rapid iterations allow teams to react quickly to meet the changing needs of users, allowing teams to focus more on maintaining flexibility.

But Go also has shortcomings, such as the lack of precise control over memory and some low-level operations, and C language just makes up for this defect. The finer control provided by the C language allows for more precision, making C an ideal language for low-level operations. These low-level operations are unlikely to change, and C also improves performance over Go. So, if you are a Gopher with performance and low-level operational needs, there are good reasons to learn C.

The advantages of C are manifested closest to the underlying machine, while the advantages of Go are maximized closer to the user. Of course, that’s not to say neither can work in the other’s space, but doing so adds “friction.” The case for rewriting a library or service in C becomes even stronger when your needs shift from a quest for flexibility to a focus on efficiency.

In conclusion, while Go and C are designed quite differently, they also share many similarities and have the foundation to play to their compatibility advantages. And, when we use the two at the same time, we can have both great flexibility and good performance, which can be said to complement each other!

5. Write at the end

In today’s snack, I mainly explained based on the comparison between C and Go, and did not elaborate on the characteristics of the Go language. If you want to learn more about the design philosophy, grammatical features, and programming related knowledge of Go language, welcome to study my column “Tony Bai · Go Language First Lesson” on Geek Time. In this course, I will use my ten years of Gopher experience to bring you a systematic and complete introductory path to the Go language.

Thank you for being here, and if today’s content helped you, please share it with your friends.


“Gopher Tribe” Knowledge Planet aims to create a high-quality Go learning and advanced community! High-quality first published Go technical articles, “three-day” first published reading rights, analysis of the current situation of Go language development twice a year, reading the fresh Gopher daily 1 hour in advance every day, online courses, technical columns, book content preview, must answer within 6 hours Guaranteed to meet all your needs about the Go language ecosystem! In 2022, the Gopher tribe will be fully revised, and will continue to share knowledge, skills and practices in the Go language and Go application fields, and add many forms of interaction. Everyone is welcome to join!

img{512x368}

img{512x368}

img{512x368}

img{512x368}

I love texting : Enterprise-level SMS platform customization development expert https://51smspush.com/. smspush : A customized SMS platform that can be deployed within the enterprise, with three-network coverage, not afraid of large concurrent access, and can be customized and expanded; the content of the SMS is determined by you, no longer bound, with rich interfaces, long SMS support, and optional signature. On April 8, 2020, China’s three major telecom operators jointly released the “5G Message White Paper”, and the 51 SMS platform will also be newly upgraded to the “51 Commercial Message Platform” to fully support 5G RCS messages.

The famous cloud hosting service provider DigitalOcean released the latest hosting plan. The entry-level Droplet configuration is upgraded to: 1 core CPU, 1G memory, 25G high-speed SSD, and the price is 5$/month. Friends who need to use DigitalOcean can open this link : https://ift.tt/MBGPLng to open your DO host road.

Gopher Daily Archive Repository – https://ift.tt/6D45vPU

my contact information:

  • Weibo: https://ift.tt/B3u9Win
  • WeChat public account: iamtonybai
  • Blog: tonybai.com
  • github: https://ift.tt/4zGUydn
  • “Gopher Tribe” Planet of Knowledge: https://ift.tt/ML63tip

Business cooperation methods: writing, publishing books, training, online courses, partnership entrepreneurship, consulting, advertising cooperation.

© 2022, bigwhite . All rights reserved.

This article is reprinted from https://tonybai.com/2022/05/16/the-short-guide-of-embracing-c-lang-for-gopher/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment