C programming language
The C programming language is a standardized imperative computer programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating system. It has since spread to many other operating systems, and is one of the most widely used programming languages. C is prized for its efficiency, and is the most popular programming language for writing system software, though it is also used for writing applications. It is also commonly used in computer science education, despite not being designed for novices.
Relation to C++
The C++ programming language was originally derived from C. However, not every C program is a valid C++ program. As C and C++ have evolved independently, there has been an increase in the number of incompatibilities between the two languages http://david.tribble.com/text/cdiffs.htm. The latest revision of C, C99, created a number of additional conflicting features. The differences make it hard to write programs and libraries that are compiled and function correctly as either C or C++ code, and confuse those who program in both languages. The disparity also makes it hard for either language to adopt features from the other one.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Bjarne Stroustrup, the creator of C++, has repeatedly suggested http://www.research.att.com/~bs/sibling_rivalry.pdf that the incompatibilities between C and C++ should be reduced as much as possible in order to maximize inter-operability between the two languages. Others have argued that since C and C++ are two different languages, compatibility between them is useful but not vital; according to this camp, efforts to reduce incompatibility should not hinder attempts to improve each language in isolation.
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
Today, the primary differences (as opposed to the additions of C++, such as classes, templates, namespaces, overloading) between the two languages are:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
inline— inline functions are in the global scope in C++, and in the file (so-called "static") scope in C. In simple terms, this means that in C++, any definition of any inline function (but irrespective of C++ function overloading) must conform to C++'s "One Definition Rule" or ODR, requiring that either there be a single definition of any inline function or that all definitions be semantically equivalent; but that in C, the same inline function could be defined differently in different translation units (translation unit typically refers to a file).- The
boolkeyword in C99 is in its own header,. Previous C standards did not define a boolean type, and various (incompatible) methods were used to simulate a boolean type. - Character constants (enclosed in single quotes) have the size of an
intin C and acharin C++. That is to say, in C,sizeof('a') == sizeof(int); in C++,sizeof('a') == sizeof(char). Nevertheless, even in C they will never exceed the values that acharcan store, so(char)'a'is a safe conversion. - Additional keywords were introduced in C++, and thus they cannot be used as identifiers as they could in C. (for example,
try,catch,template,new,delete, ...) - In C++, the compiler automatically creates a "tag" for every
struct,unionorenum, sostruct S {};in C++ is equivalent totypedef struct S {} S;in C. - Mandatory prototype declarations for functions
- The
inlinekeyword - The removal of the "implicit int" return value
C99 adopted some features that first appeared in C++. Among them are:
~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ Table of Content ~
| ► | Introduction |
| ► | Features |
| ► | Problems |
| ► | History |
| ► | Relation to C++ |
| ► | Intermediate language |
| ► | See also |
| ► | References |
| ► | External links |
~ What's Hot ~
~ Community ~
| ► | History Forum Come and discuss about History, Civilizations, Historical Events and Figures |
| ► | History Web-Ring A community of sites, blogs and forums dedicated to History. Do not hesitate to submit your site. |
and are licensed under the GNU Free Documentation License.
Lexicon - Privacy Policy - Spiritus-Temporis.com ©2005.
