Cloud winds recently wrote a blog " C Language Past and Present . " As a long-term use of C language development network game server programmers, clouds the wind is reason to write such a text, but still feel not enough to talk about depth, C language is not in the status of the industry how to use the description of some boundless.
Comparing the system here would like to talk about individual C ways of understanding language learning. Were in accordance with the books, test environment set up, network resources are introduced, hoping to write more complete and comprehensive number, to want to learn C language, a valuable reference for a friend.
Why learn C language?
Why study the use of C language? Why learn a great age than themselves programming language?
How do I learn programming language in the previous blog post http://sunxiunan.com/?p=1597 in that, choose a programming language, "Why do the study" this purpose is the most important purpose is not clear no law good. This is why a lot of friends at the university required students to C language was not studied to understand the reasons for that. Because the purpose of study is not clear, of course, no incentive to learn. Another reason is the C language is the language of a very practical project, it is not from an Institute of a University College, but a real need to generate from the project, along with the rise of Unix and popular, simple semantics clear, powerful and not bloated, but points are concise and simple, it is essential for daily life and travel and work to good friend.
C language than C + + is one of the advantages of the principle of least surprise, one 12 is two, will not produce some strange additional private product. Using C + + to be a case, such a function prototype void PassWithClassValue (COneClass clsParam1), a little understanding of C + + friends will know, if you do not realize COneClass copy constructor, the compiler will kindly help you achieve one, and in calling this function PassWithClassValue time secretly copy constructor is called a provisional object as a parameter, for some circumstances, such as the preparation of the operating system must optimize the performance of such scenarios, these self-righteous things are very evil thing.
C language itself only provides the necessary language features, other more complex functions such as document processing, mathematical calculations, etc. are provided to library functions, or Lian malloc, free of this "must have" feature, is the way to the standard library functions provided, rather than as C-cores. Well-known in the great all-inclusive "K & R" at the beginning of the reference, for in fact can be done while, but for you can write more concise words, for the C language for is not necessary. Beside the point as to say that in other programming languages Lua can be inherited in C-simple design philosophy, and even continue this almost necessary keywords have been refused to join the maillist and wiki in Lua have mentioned continue in this problem, Lua Lua language defenders that continue for it is not necessary, do not consider adding the follow-up version of the keyword. This simple philosophy has to C language portability, portability, good company, also makes a lot of embedded systems still use the C programming language as the main working language.
Java language has a slogan: "write once, run everywhere" is cross-platform, this gimmick. Actually C language almost from the early beginning of "write once, compile everywhere" in the ANSI in 1989 after the unification of the C language standard (called C89), if a particular platform to achieve the C89 compiler integrity standards and your code does not use some special expansion (GCC and Microsoft have their own compiler specific extensions), then the code will be able to compile, and then realize what operating system-related library, C language is very simple transplantation things. Lua can be used as an example, Lua itself is full compliance with the C89 standard, do not use any specific extensions, which also ensures a C language compiler platform, can be compiled with Lua. Can compile and run C language hardware platform from A discharged to Z, is really a very interesting thing.
C language is a relatively rare application of an extremely broad field of language. Operating system such as the preparation of this highly difficult problem, only the C + +, assembly language can do. C language to write server-side software such as Apache, Nginx, or write GUI programs such as GTK. The first version of most programming languages through the C language, using the previously mentioned "write once, compile everywhere", the largest of these programming language to ensure portability. In the Web development field, C language of the application of relatively small, it is also a choice of results, Web developers need to use PHP, Ruby, Python way of dynamic languages, you can quickly modify to Express, you can best meet Yong Hu constantly changing demand, this is C language weaknesses. If the programming language applications to the management software from hardware, Web program to be a very rough from the bottom of the array, C language is more suitable for areas near the bottom part of the hardware, but more emphasis on the emerging language of senior management or Web development that kinds of areas of relatively close to the end user. Popular hybrid development model is the use of C language code or background part of the underlying high-performance server code, the use of dynamic languages such as Python to do front-end development, give full play to the advantages of their respective forces.
The shortcomings mentioned in C language, it is often the lack of this or that characteristic, such as was proposed to include GC, was proposed to include parallel or concurrent support of someone that does not have a fairly complete C + + exception similar strategy. Some of these features can be achieved through the introduction of third-party libraries, but the C language's design philosophy in fact determined that it does not like C + + as "very strong." Even if some people hope Yinru features will still certain people like certain people do not like the Qing Xing, now the feature is C language application in the field is already good enough, other features can be through a specific program language Shixian, and by C API and C language programs to interact. Any craftsman using only one tool can not complete his work, combining different tools to complete the task faster and better.
That C API, and marginally brief, we know the api Yehao windows operating system, Linux system api Ye Hao, or would like to Ruby, Python extension modules written, C language form of the function definition is the only choice . C language is like a middle layer, or glue, different programming language if they want to function modules mixed use, C language is the best option.
Put so much on the benefits of C language, then learn C language is suitable to see your own judgments, for example, to conduct an embedded project, or the need for server-side development, or to write a performance-related components, etc, C language is more useful choice. Also you can use in C + +, the process of intentional way of thinking using the C language, to learn C language clear and simple and neat design ideas, design level of the programming will be greatly improved.
C language learning
In the previous http://sunxiunan.com/?p=1597 alluded to a more systematic learning of a new way of programming languages, C language learning can also follow a similar order: reading books, read the code, write and debug practical procedures, participate in online discussions of advanced topics.
Start learning a language is usually read reference books. I recommend a few of the great classic books, carefully read the full repeated several times, "the chance to read a hundred times since its meaning is." Select the advantage of C language learning, these books cover essentially complete all aspects of C language programming in the field, unlike C + +, as a pile of books or even read some confused, there is still so difficult to understand as a trap.
1, reference books
In the watercress, a book list above, we can directly reference http://book.douban.com/doulist/636329/
In the following brief comment about, read the order listed in the order of the best light.
"The C Programming Language" http://book.douban.com/subject/1230004/
If you just want to buy a book to learn C language, just buy that this is enough. If you have enough funds, I suggest you to buy some of this, the office, at home are placed one to hand, can be looking through. With three words to describe it is: Classic! Classic! Classic! Only this thin little book over 200 pages covering every aspect of C language, unprecedented and no one will follow, for any kind words are not enough to describe it.
"The C Programming Language" (later known as K & R) which contains a simple parser, how malloc contains, contains a complete operating system directory browsing program, high availability of these procedures, can be said If any one language can learn their own hands to achieve the above functions independently, basically you can be a beginning. K & R book which each segment contains well worth exploring the software development engineering practice, if not a certain development experience, in fact, is not apparent in the icebergs below the content, such as at the beginning of a chapter on the proposed to write the complete code of this approach to teaching, while those in the book or the C-trap problem where possible, have referred to, but because of space constraints, it was very simple, very hard to click on the read. I was reading this book a complete word for word, hope to make some notes, write a few blog to share.
"C Programming Language (2nd Edition version)" http://book.douban.com/subject/1139336/
This is the Chinese translation of K & R, you can start to see a Chinese translation, the original English version and then read it again, only to learn English, they can experience the kind of simple text and beautiful style.
"C traps and defects" http://book.douban.com/subject/2778632/
"C Programming experts" http://book.douban.com/subject/2377310/
These two books is to learn and use C language's friends must-two books, such as "C programming expert," devotes 23 chapters detail the array and pointers in C language the difference between the two book K & R to some extent as a way to skip the place in detail to add, highly recommended.
"C Language Reference Manual" http://book.douban.com/subject/2132084/
This is the last one you'd better buy a home is highly recommended as an essential desk reference book. Slightly in front of a few books or short, or focus on a specific topic, do not search for when they encounter problems. This is the "C Language Reference Manual" can be seen as a C language programming, "Xinhua Dictionary", a comprehensive and authoritative. Which also covers the content of C99, followed by the times.
The following books can be used as cross-reference, but also very valuable, but also suggest that you have bought the books as a friend, long time, and fresh, like I recommend these books or amazon in douban score very high on , and repeatedly reprinted.
"C and the pointer" http://book.douban.com/subject/1229973/
The importance of pointer, learned C language (or C + +) friends all know that this book has even overstating the pointer to an equal status with the C language, is actually introduced from the beginning, as a teaching reference books are also possible.
"C Standard Library" http://book.douban.com/subject/3775842/
This book is devoted to the C language standard library to achieve, such as malloc algorithm, using standard C language, how to write? strlen this function should be achieved? Although many of the code book and the real difference between the number of C standard library (due to the standard library to consider performance optimization, and many functions have some specific trick), but definitely worth considering.
"You must know the 495 C language" http://book.douban.com/subject/3422332/
This book is actually printed version of the C-FAQ, C-FAQ FAQ in various programming languages can be described as first-class quality. If you want to apply or recruit C-Related programmer, this book must be reference.
"Linux C Programming one-stop learning" http://book.douban.com/subject/4141733/
This book is based on a specific operating system Linux to introduce C programming language, can be used as a textbook or computer-related professional entry-reference, the book is the only one inside its own original programming books were very rare. Almost all the book content online directly to the public, be modified for the views of readers, which is very rare in an open manner. Is recommended you buy.
Learning C language, must not only read, the book which should be hands-on exercises to complete the project needs (such as the preparation of a directory browser) and exercises for each chapter title. This needs to laboratory conditions, the following simple to do some different operating system introduced.
2, hands-on experimental environment set up
Not investigated, do not know the school to learn C language is not still follow the Transplantation and Hemopurification teachers use TurboC2.0 programming, or the combination, if so, would be too bad, and they quickly set aside.
The following introduces the integration of different operating system platform programming environment for beginners as well as based on my personal preferences do not recommend you use the vim command line program, and directly on the IDE.
Windows systems recommend you use Code:: blocks of this software. The software comes with the biggest advantage is based on the GCC mingw and GDB, as long as download about 70M package, you can complete support for C + +, C language programming. Features (such as debugging) is also very powerful, version of the update is also faster. Note the name of a mingw download selected files, such as the latest version of codeblocks-10.05mingw-setup.exe (version may vary.)
If you need to do the development of Windows operating system, you can download the Visual C + + 2010 Express.
Because Code:: Blocks does not include Windows programming header files (actually is because there is no Windows SDK), can not write Windows operating system-related interface applications or services such procedures. The VC + + Express comes with the headers and programming libraries, although the function a little shabby, but basic enough to use for practice.
For students of computer science friends, it is recommended you use the Linux operating system, or a little more detail is to use Xubuntu as a desktop operating system, using Netbeans and the GCC this combination (of course, can choose to Code:: Blocks). Under the Xubuntu can apt-get install build-essential procedures of this command to install gcc, has been compiled in Terminal C language program, but for convenience, we can choose Netbeans for C + + support package can be in the Netbeans site Download.
If you use Apple Mac, XCode is no doubt an excellent programming choice, XCode Apple Developer web site can be downloaded for free in the IPhone SDK also includes XCode.
If you do not have appropriate programming environment, also need to test some simple code, you can use http://codepad.org/ services, online preparation to run the code.
Another suggestion is to apply for a github.com account, in gist.github.com practice can save your code, you do not carry around a U disk.
3, network resources
If you want to use the 10 minutes time understanding the ins and outs of C language, past lives, this Wikipedia page http://en.wikipedia.org/wiki/C_% 28programming_language% 29 is the best option.
Can be seen from Wikipedia, C language designed in 1972 by Dennis Ritchie's imperative, structured programming language paradigm. Type of weak static type, need to explicitly define. The latest international standards for the C99. Designed mainly by the B, ALGOL68, assembly language, PL / I, FORTRAN effect, C language has also affected a large number of programming languages, such as C + +, Objective-C, C #, Java, Go, PHP, Python, etc. (personal feel is strongly influenced by C PHP, basically C programming-based programmer, PHP is very easy to get started, and in addition to PHP's OO part).
In the Wikipedia article describes in great length that the C language of the missing features, such as object-oriented, multi-threaded, GC, exception handling, etc., of course, some find fault, if you need these features, can use other programming languages . Another presentation focused on the "undefined behavior", some of us take for granted the results, in fact, the standard C language does not clearly defined, assuming that these acts should be, when the program or use another compiler compiler to run different versions of are likely to produce a bug.
Then Wikipedia article about the usefulness of the C language, programming language must be recognized despite the hundreds of now, can they be called "system level" of very few new languages can be called only Go. Large-scale software projects now use C language is completely unlikely, but the core structures can use C, C + + development tools relatively high price, C language-related free supporting software development is very rich, such as splint, valgrind, many After the core library is also very stable long-term use.
As the C language wide variety of platforms and compiler support is relatively mature and reliable, many programming languages choose C language as an intermediate layer, such as Glasgow Haskell compiler is doing.
One can find a lot of C programming language where relevant information is "Delicious Bookmarks", by searching a specific keyword (C + programming) can find a lot to tap the resources of http://delicious.com/search?p=c+ programming
You can also refer to dmoz.org in C language classification http://www.dmoz.org/Computers/Programming/Languages/C/ aging performance compared to almost delicious bookmarks, but the classification and comparison of systems should be easier to find.
Programmers are often lazy, "used", "copy doctrine" is also very popular and effective, when on a certain function or keyword is not very understanding when to see how others use, would be very instructive . Here are some commonly used code search site, the most commonly used is google's codesearch: http://codesearch.google.com , different conditions and by the regular expression search for specific keywords. Also can refer to Wikipedia, a " sample of the article with the C language "category, which is also very well written code. You can also search for related items at github.com. In the previous blog article, I also introduced a Web site called the Rosetta code http://rosettacode.org/ this site can be found in different programming languages for a solution to the problem, for learning more is very convenient.
Learning to program also needs a large number of famous classical code reading, and learning to read Chinese classics in English needs a lot of sense, C language programming quality projects that are "colorful flags flying, sea of people", individual recommendations can see Lua, Sqlite, Nginx code of these projects, small amount of code, and code quality is relatively high. Also take a look at Linux kernel code, though there have been many books can help interpret. Read the code on how well we can refer to the "Code Reading" book.
Read several books, wrote some code, but also a little and read other people's code, you should use the C language to do real work on problems they encountered, so that C language to truly become your Swiss army knife. Only if you frequently use C language programming, often thinking about how to design an elegant and efficient through the C system in order to gain a deeper understanding of C language design philosophy.
Also to http://stackoverflow.com involved answering questions, browse other people's questions to gain knowledge, such as this http://stackoverflow.com/questions/2054939/char-is-signed-or-unsigned-by -default language on the introduction of a C char type on a small trap.
C language learning, there are some difficulties need to pay more attention, such as the pointer and the array of differences, how to interpret the complex type definition, the proper use of preprocessing preprocessor and macro definitions. In fact, these elements are repeatedly mentioned in the previous books, if the learning step by step down, should not be a problem.
When the C language to learn about time, you can also learn a dynamic language, such as Lua or Python, try to mix in actual work projects a dynamic language and C language, one plus one power play just two, but is 2 (joking about, ha ha).
Have any questions, please message.
Some useful C-language network resources:
Organization for Standardization ISO JTC1/SC22/WG14 C language home page, where you can find the document ISO C: http://www.open-std.org/jtc1/sc22/wg14/
"The Development of the C Language" of Dennis Ritchie, very classic papers. http://cm.bell-labs.com/cm/cs/who/dmr/chist.html
"C Language Panorama," the contents of this website is comprehensive: http://www.softpanorama.org/Lang/c.shtml
Dan Saks's column in embedded.com Programming Pointer , which the article is very deep, well worth reading.
http://www.lysator.liu.se/c/c-www.html It is also a C language resource summary page.
http://www.ioccc.org/index.html confusion C language code contest, very famous.
http://en.wikipedia.org/wiki/Underhanded_C_Contest Another C language programming contest, mainly for the hackers.
comp.lang.c and c.moderated two discussion groups recommend subscriptions, representing the largest C-related programming Internet Forum:
Here on the C language bit manipulation of the various collected many times in the interview questions often. http://graphics.stanford.edu/ ~ seander / bithacks.html
Taiwan used to C Daren Jserv blog, suggest that you subscribe: http://blog.linux.org.tw/ ~ jserv /
Some deserve attention and study C language-related items:
TinyCC, many of the items was used as dynamic compilation C language compiler engine: http://bellard.org/tcc/
GCC standard library implementation: http://en.wikipedia.org/wiki/GNU_C_Library
Glib is supporting the underlying GTK programming library, with the C standard library is not the same, in the C language object-oriented mechanism is implemented: http://en.wikipedia.org/wiki/GLib
dietlibc introduced in the previous blog article, C standard library to another realization: http://www.fefe.de/dietlibc/
Some C language programming tool software can be used to help you improve the code quality:
PMD can be used to detect duplicate code http://pmd.sourceforge.net/cpd.html
static analysis of projects llvm http://clang-analyzer.llvm.org/
C programming language programming specification standards:
cert this document in Chinese translated version of the domestic: https: / / www.securecoding.cert.org/confluence/display/seccode/CERT+ C + Secure + Coding + Standard
C language programming books and tutorials:
http://publications.gbdirect.co.uk/c_book/ that this was a very detailed, you can see it as similar to the Transplantation and Hemopurification version of the textbook.
http://www.knosof.co.uk/cbook/cbook.html recommended that the clouds the wind has been quite in-depth introduction to the C99 standard, in-depth details of when to read.
http://www.duckware.com/bugfreec/index.html circulated on the Internet of a book in Chinese, "write optimization, efficient, error-free to code", and some English photocopy another version of "Programming the essence."
http://wangcong.org/blog/?page_id=196 of Cong Wang is very hard geek, read from two sample chapters, contains a considerable amount of content.
"C Language depth anatomy" in Baidu this library or google search that you can read some reference to sex.
"C standard and the achievement" of the new Yao Yan, his "depth exploration of C, C + +" be more in-depth books on the year, unfortunately out of print. This book can also be found in the library to Baidu. This book is also quite worth reading.
Liang Ge Ge C Language Learning Notes http://caterpillar.onlyfun.net/Gossip/CGossip/CGossip.html
C and C + + compatibility problem http://en.wikipedia.org/wiki/Compatibility_of_C_and_C% 2B% 2B
Another document on the C and C + + standards compliance issues: http://david.tribble.com/text/cdiffs.htm
"C Elements of Style" http://www.oualline.com/books.free/style/index.html
"Linux Security Programming" http://www.dwheeler.com/secure-programs/
"C Craft" electronic version of the http://crypto.stanford.edu/ ~ blynn / c /
"The function pointer tutorials" function pointer tutorials. http://www.newty.de/fpt/index.html
C language programming and Unix system calls, would like to use C programming in Unix or Linux, you may visit. http://www.cs.cf.ac.uk/Dave/C/
Optimizing C, C + + code http://www.eventhelix.com/RealtimeMantra/Basics/OptimizingCAndCPPCode.htm
Illustrated description of C language pointer http://boredzo.org/pointers/
Another paper describes a C language optimized article http://www.prism.uvsq.fr/ ~ cedb / local_copies / lee.html
A C language teaching ppt http://www.slideshare.net/petdance/just-enough-c-for-open-source-programmers
Some C programming language under Unix-related article http://users.actcom.co.il/ ~ choo / lupg / tutorials / index.html
Unix, how to establish static and dynamic C-library http://users.actcom.co.il/ ~ choo / lupg / tutorials / libraries / unix-c-libraries.html
Some C language programming skills http://users.bestweb.net/ ~ ctips /
Advanced C programming, advanced C language programming, you can raise the level, very helpful http://www.mpi-inf.mpg.de/departments/rg1/teaching/advancedc-ws08/literature.html
C language question and answer, these questions can also be used to interview http://www.gowrikumar.com/c/