C Language

Conquering C

To pick the right projects for C or C++, and then use the language effectively, you have to ignore a lot of conventional attitudes towards C and C programming practices. Many of these attitudes and practices are rooted in a time and place 15 years ago when C was a major step forward for systems programmers. Today there are good alternatives to C for many applications, and programming practices have changed considerably. One of the most important differences between 15 years ago and today is that businesses are placing much more emphasis on controlling software development costs than on modest improvements in performance. Thus, developers trying to control costs want to avoid language features such as address pointers and coding practices such as folding a sequence of distinct operations into a single statement.

If you do find yourself (or your staff) programming in C, the attitude with which you approach the task has a lot to do with whether you conquer C or it conquers you. To successfully program in C, you can't just memorize more C rules, code more carefully, and keep the debugger close at hand. You have to start with an awareness of what types of languages C and C++ are, and plan your strategy for preventing accidents. With some forewarning, and the right attitude, it's not terribly difficult to do, although compared to other languages, C can remain a frustratingly primitive - and C++ an agitatingly complex - way to write software.

There are some bright spots in the world of C programming, however. If you don't succumb to the "this is the way all C programmers do it" method of programming, you can enjoy the benefits of an enormous collection of C and C++ source and executable libraries, and a large set of C-related tools, such as "C-aware" editors and programmer workbenches. And there's no question that the fierce competition among C compiler vendors, especially on the PC, has produced excellent and affordable C compilers. The performance of well-designed C programs compiled with one of the good optimizing compilers is usually excellent, too.

So don't fear that the only result of programming in C is spending large amounts of time chasing wild pointers. With the right amount of respect for the language and not too much respect for C "traditions," you can enjoy the advantages of the broad C compiler and tools market. All it takes is going into it with your eyes wide open and programming with a little "common sense."

by BrainBellupdated
Advertisement: