The beginning
The 'C' Language has been developed by Dennis M. Ritchie inspired by the language B, for use with the UNIX operating system in 1972. He returned from the main function on October 12, 2011.
The language was originally designed to help the development of Unix Operating System. The UNIX is one of the first OS developed in a high level language.
ISO C99
Links
Most used free compilers of C/C++: MingW and Visual C++ Express Edition.
C1X
inline functions
long long int complex data types
Output: 1, 2, 4, 4, 8
A simple rule of the size of the integer
types is
Variable-length arrays
Is valid in C!
variadic macros
Implicit casting of ‘void’ pointer
And not
Calling ‘main’ function recursively
The above code will just make an infinite loop.
‘restrict’ keyword
Flexible array
members
Here, the array member ‘data’ of object ‘p’ will have 10 characters length and that of ‘q’ will have 15 characters length.
Designated initializers
Both the above statements are equivalent initializations.
are equal.
Compound literals
The language has done its role to build and shape the computer era. Born in Bell and Brought up by Brilliants! The beauty of C is it believes her programmers. So, if anyone feels that C lacks a feature which helps you from doing something nasty, woke up, you are a programmer, not a school kid! And C is a real programmer's language.
In 1966
Martin Richards of the University of Cambridge developed a programming language
called Basic Combined Programming Language (BCPL).
In 1969 Kenneth Lane Thompson (Ken
Thompson) developed a stripped-down version of the BCPL programming language
called 'B' for Bell Laboratories. Currently Thompson is working with Google.The 'C' Language has been developed by Dennis M. Ritchie inspired by the language B, for use with the UNIX operating system in 1972. He returned from the main function on October 12, 2011.
The language was originally designed to help the development of Unix Operating System. The UNIX is one of the first OS developed in a high level language.
The earlier version of C has been changed
many times to incorporate powerful features of different computer
architectures. One of such feature is the ‘struct’ type added in 1973.
By the first edition of the book, 'The C
Programming Language' by Brian Kernighan and Dennis Ritchie in 1978, the
language got its first written specification. The version of the language
described in this book is known as K&R.
In the book, they have introduced many
additional features to the language such as
-
I/O libraries
-
‘long’ and ‘unsigned’ type
modifiers.
ANSI/ISO C90
In 1983,
the American National Standards Institute (ANSI) formed a committee, to
establish a standard specification of C. And in 1989, the first draft of the
standard was published. This version often referred to as ANSI C or C89.
In 1990, International Organization for
Standardization (ISO) adopts the ANSI standard of C language as ISO/IEC
9899:1990 and this is referred to as C90. (Both C89 and C90 are the same
language). ANSI no longer develops the C standard independently, but defers to
the ISO C standard.
ISO C99
The C
standard was further revised and lead to the publication of ISO/IEC 9899:1999
in 1999, which is commonly referred to as "C99". C99 introduced
several new features in the language and some of them are
Some of these features are borrowed from
other languages like C++, but After C99, C is no more considered as a subset of
C++. C supports many features not included in C++.
Links
Most used free compilers of C/C++: MingW and Visual C++ Express Edition.
Some FOSS IDEs for MingW: CodeBlocks, Dev-C++, NotePad++ (More
like an editor) and TextPad (my favorite,
and again an editor, you may read this: How to
configure TextPad as MingW IDE)
Comparison of
different Visual Studio editions.
C1X
In 2007,
the ISO started revising the C standard, informally called "C1X".
For ISO, the major guiding principles for
drafting the standard are
-
Existing code is important,
existing implementations are not.
-
C code can be portable.
-
C code can be non-portable.
-
Avoid "quiet changes."
-
A standard is a treaty between
implementer and programmer.
-
Keep the spirit of C. And below
are some of the facets of the spirit of C:
ü Trust the programmer.
ü Don't prevent the programmer from doing what needs to be done.
ü Keep the language small and simple.
ü Provide only one way to do an operation.
ü Make it fast, even if it is not guaranteed to be portable.
Examples
The examples
given below are linked from the above sessions. Make use of those links for
better understanding. Avoidance of these examples don’t affect the flow of the
article and can be skipped if found difficult.
inline functions
Actual source code
|
After inline
expansion
|
Inline is
exactly a request to the compiler for expanding the code inline; it may or may
not do it according to the implementation. ‘inline’ functions are not same as
macros. Macros are handled by the preprocessor and they do not have a type
check.
long long int complex data types
Output: 1, 2, 4, 4, 8
All sizes are in bytes.
Variable-length arrays
This is, what exactly the name suggest
Is valid in C!
variadic macros
A macro can be declared to accept a
variable number of arguments much as a function can. The syntax for defining
the macro is similar to that of a function.
Support for one-line comments
Implicit casting of ‘void’ pointer
The void* can be converted to any one
without a typecast. Example of an impact is ‘malloc’. The old return type of
the same function was char* and after the introduction of void in C, it is
changed to void*. Now the usage should be:
And not
Calling ‘main’ function recursively
This is not allowed in C++. Even there is
little usage, it is supported in C.
The above code will just make an infinite loop.
The major use of this feature is in
obfuscation.
‘restrict’ keyword
This keyword is used to tell the compiler
that an object is accessed only through the ‘restrict’ qualified pointer. This
allows the compiler to perform certain optimizations. And accessing such an object
using another pointer will cause undefined behavior.
Flexible array
members
A structure can have an array member at the
end of it without specifying a size. While allocating memory for the structure object,
by allocating more memory for this array member one can extend the size of it.
Here, the array member ‘data’ of object ‘p’ will have 10 characters length and that of ‘q’ will have 15 characters length.
This feature allows initializing the
members of an array or a structure in any order.
Both the above statements are equivalent initializations.
Similarly for a structure
are equal.
A compound literal looks like a cast
containing an initializer. Its value is an object of the type specified in the
cast, containing the elements specified in the initializer
Is equivalent to:
Future
The language has done its role to build and shape the computer era. Born in Bell and Brought up by Brilliants! The beauty of C is it believes her programmers. So, if anyone feels that C lacks a feature which helps you from doing something nasty, woke up, you are a programmer, not a school kid! And C is a real programmer's language.
No comments:
Post a Comment