Chitika

Language Tools

Language Tools

Tools have been created to help C programmers avoid some of the problems inherent in the language, such as statements with undefined behavior or statements that are not a good practice because they are more likely to result in unintended behavior or run-time errors.

Automated source code checking and auditing are beneficial in any language, and for C many such tools exist, such as Lint. A common practice is to use Lint to detect questionable code when a program is first written. Once a program passes Lint, it is then compiled using the C compiler. Also, many compilers can optionally warn about syntactically valid constructs that are likely to actually be errors. MISRA C is a proprietary set of guidelines to avoid such questionable code, developed for embedded systems.

There are also compilers, libraries and operating system level mechanisms for performing array bounds checking, buffer overflow detection, serialization and automatic garbage collection, that are not a standard part of C.

Tools such as Purify, Valgrind, and linking with libraries containing special versions of the memory allocation functions can help uncover runtime memory errors.
[edit] Related languages

C has directly or indirectly influenced many later languages such as Java, Perl, Python, PHP, JavaScript, LPC, C# and Unix's C Shell. The most pervasive influence has been syntactical: all of the languages mentioned combine the statement and (more or less recognizably) expression syntax of C with type systems, data models and/or large-scale program structures that differ from those of C, sometimes radically.

When object-oriented languages became popular, C++ and Objective-C were two different extensions of C that provided object-oriented capabilities. Both languages were originally implemented as source-to-source compilers; source code was translated into C, and then compiled with a C compiler.

The C++ programming language was devised by Bjarne Stroustrup as one approach to providing object-oriented functionality with C-like syntax. C++ adds greater typing strength, scoping and other tools useful in object-oriented programming and permits generic programming via templates. Nearly a superset of C, C++ now supports most of C, with a few exceptions (see Compatibility of C and C++ for an exhaustive list of differences).

Objective-C was originally a very "thin" layer on top of, and remains a strict superset of C that permits object-oriented programming using a hybrid dynamic/static typing paradigm. Objective-C derives its syntax from both C and Smalltalk: syntax that involves preprocessing, expressions, function declarations and function calls is inherited from C, while the syntax for object-oriented features was originally taken from Smalltalk.

C# was designed in order to provide Microsoft's .NET Framework with a programming language that could be easily learned by programmers already familiar with C or C++. Conventions like the semicolon at the end of statements and the curly brackets used to separate the components in the hierarchy of code are evidence of C#'s C-based heritage.

The D programming language makes a clean break with C while maintaining the same general syntax, unlike C++, which maintains nearly complete backwards compatibility with C. D abandons a number of features of C which Walter Bright (the designer of D) considered undesirable, including the C preprocessor and trigraphs. Some, but not all, of D's extensions to C overlap with those of C++.

Limbo is a language developed by a team at Bell Labs, and while it retains some of the syntax and the general style of C, it also includes garbage collection and CSP-based concurrency.

The Go programming language, under development at Google, streamlines C's syntax by eliminating unnecessary semicolons and parentheses. It supports a simpler form of object-oriented programming than those of C++ or Java, and also adds garbage collection and concurrency features.

Python has a different sort of C heritage. While the syntax and semantics of Python are radically different from C, the most widely used Python implementation, CPython, is an open source C program. This allows C users to extend Python with C, or embed Python into C programs. This close relationship is one of the key factors leading to Python's success as a general-use dynamic language.

Perl is another example of a popular programming language rooted in C. The overall structure of Perl derives broadly from C. The standard Perl implementation is written in C and supports extensions written in C.

No comments:

Post a Comment