100TB Blog

Three Wonderful “C” Programming Conventions Left Behind by Dennis Ritchie

Three Wonderful “C” Programming Conventions Left Behind by Dennis Ritchie

Published January 15th, 2013 by Gustavo Fring

Developed between 1969 and 1973, the C programming language is among the most widely used programming languages of all time; it would be hard to find a computing platform for which there is no C compiler. C was originally developed by the recently deceased programming pioneer Dennis Ritchie, during his time at AT&T Bell Labs.

It is true that C has been supplanted to a large degree by other languages more suited for current programming needs; however, many of the underpinnings of today’s computer systems were originally written in C, perhaps most notably the UNIX operating system. The Internet also rests on a foundation of C programming, with servers and other network hardware still running C.

Here are just three of the features developed by Ritchie that make up his brilliant legacy.

Directory Structures

C allows for flexible directory structures, with the exact arrangement of files and directories used by a program being left largely for the programmer to determine. The structures to be used in a program need to be defined at the beginning of the coding process.

Type-Unsafe Code

Unlike most modern programming languages such as Java, C is not a strongly typed language. This means, essentially, that C does not perform rigorous compile-time checks to make sure that there are no constraint violations. In fact, most versions of C do now perform these checks – however, it’s possible to simply override them. This might not seem like a beneficial feature; but it enables certain low-level programming tasks that might otherwise be impossible.

Switch Statements and Floating Point Representation

The C switch statement allows an expression or variable to be compared to one of a number of constant integer values. The program then branches depending on which constant the variable matches. Floating-point values aren’t allowed in a switch statement, as floating-point notation can’t adequately represent real numbers.

One Flawed Convention

Okay, we had to mention one flaw, right? C’s data types are, unfortunately, not portable. The data size of the data type will vary depending on the target processor. For example, a float might be a 32-bit, a 64-bit or an 80-bit value; an int could be 8 bits, 16 bits, 32 bits or possibly 64 bits. For this reason, unless you must use the C standard library, you will need to create your own header file for your program, which defines the data types you’ll be using.

We would be interested to hear what readers think of the C language and how it may have influenced their programming career. Write your comments below!

Tags: , ,

Categories: Uncategorized

Chat live now

Hello, Thanks for visiting.

Have a question about 100TB.com?

Chat with an expert

Contact Us Anytime: