Friday, June 26, 2020

Critiques on C Language

Critique
 

Two ideas are the most characteristic of C between the languages of its class: the relationship between arrays and pointers, and how the declaration syntax mimics the expression syntax. They are also among its most frequently criticized features, and often serve as stumbling blocks to beginners. In both cases, historical accidents or errors have exacerbated their difficulties. The most important of these was the tolerance of C compilers to type errors. As should be clear from the above history, C has evolved from a variety of languages. It did not suddenly appear to its early users and developers as a completely new language with its own rules; Instead, we had to continuously adapt the existing programs as the language was developed and make provision for an existing body of code. (Later, the ANSI X3J11 C standardization committee would have the same problem.)


Compilers in 1977, and even after that, did not complain about uses such as assigning between integers and pointers, or using objects of the wrong type to refer to the members of the structure. Although the language definition presented in the first edition of K&R was reasonably (though not entirely) consistent in its handling of the type rules, the book admitted that existing compilers did not enforce them. Besides, some of the rules designed to ease early transitions have contributed to later confusion. For example, empty square brackets in the declaration function int f(a) int

a[]; {....}

  

They are a living fossil, a remnant of NB 's way of declaring a pointer; an is, in this special case only, interpreted in C as a pointer. The notation survived partly because of compatibility, partly because of the rationalization that it would allow programmers to communicate to their readers an intention to pass a pointer generated from the array, rather than a reference to a single integer. Unfortunately, it serves as much to confuse the learner as it does to alert the reader.

 

In K&R C, it was the responsibility of the programmer to supply arguments of the proper type to a function call, and the existing compilers did not check for a type agreement. The failure of the original language to include the type of argument in the type of function signature was a significant weakness, indeed one that required the boldest and most painful innovation of the X3J11 committee to be remedied. The early design is explained (if not justified) by avoiding technological problems, in particular cross-checking between separate source files, and my incomplete assimilation of the implications of moving from untyped to typed language. The lint program mentioned above tried to ease the problem: among its other functions, lint checks the consistency and consistency of the entire program by scanning a set of source files, comparing the types of function arguments used in calls with those used in their definitions.


C Language

 

The syntax accident contributed to the perceived complexity of the language. The indirection operator, spelled * in C, is syntactically a unary prefix operator, as in BCPL and B. This works well in simple expressions, but in more complex cases, parentheses are needed to direct parsing.

 

For example, to distinguish indirection by a value returned by a function from calling a function designated by a pointer, one writes *fp() and (*pf)()respectively. The style used in expressions is followed by a declaration, so that names can be declared

int *fp();

int (*pf)();

 

In more ornate but still realistic cases, things get worse:

int *(*pfp)();

 

It is a pointer to a function that returns a pointer to an integer. Two effects are occurring. Most importantly, C has a relatively rich set of ways to describe types (compared, say, with Pascal). Statements in languages as expressive as C — Algol 68, for example — describe objects that are equally difficult to understand, simply because the objects themselves are complex. A second effect is due to the syntax details. Statements in C must be read in an 'inside-out' style that many find difficult to grasp [Anderson 80]. Sethi [Sethi 81] noted that many of the nested statements and expressions would have become simpler if the indirect operator had been taken as a postfix operator instead of a prefix, but by then it was too late to change. Despite its difficulties, I believe that the C approach to declarations remains plausible, and I am comfortable with it; it is a useful unifying principle.

 

The other characteristic feature of C, its treatment of arrays, is more suspect on practical grounds, although it also has real virtues. Although the relationship between pointers and arrays is unusual, this can be learned. Moreover, language has considerable power to describe important concepts, such as vectors whose length varies over time, with only a few basic rules and conventions. In particular, character strings are handled by the same mechanisms as any another array, plus the convention that a null character will terminate a string. It is interesting to compare C's approach with that of two almost contemporary languages, Algol 68 and Pascal [Jensen 74].

 

Arrays in Algol 68 either have fixed limits or are 'flexible:' a considerable mechanism is required both in language definition and in compilers to accommodate flexible arrays (and not all compilers fully implement them.) Original Pascal had only fixed-size arrays and strings, and this proved to be confined to [Kernighan 81]. Later, this was partially fixed, although the resulting language is not yet universally available.

 

C treats strings as character arrays conventionally terminated by a marker. Apart from a specific rule on string literal initialization, string semantics are fully subsumed by more general rules governing all arrays and, as a result, the language is easier to describe and translate than one that incorporates a string as a unique data type. Some costs arise from its approach: certain string operations are more expensive than other designs because the application code or library routine must occasionally search for the end of a string. After all, few built-in operations are available, and because the burden of string management falls more on the user. C's approach to strings, however, works well.

 

mistakes


On the other hand, C's treatment of arrays in general (not just strings) has unfortunate implications for both optimization and future extensions. The prevalence of pointers in C programs, whether explicitly stated or derived from arrays, means that optimizer must be prudent and must use careful data flow techniques to achieve good results. Sophisticated compilers can understand what most pointers might change, but some important uses remain difficult to analyze. Functions with pointer arguments derived from arrays, for example, are difficult to compile into efficient vector machine code, because it is rarely possible to determine that one argument pointer does not overlap data that is also referred to by another argument or accessible externally. More fundamentally, the C definition so specifically describes the semantics of arrays that changes or extensions that treat arrays as more primitive objects, and allow operations on them as a whole, are difficult to fit into the existing language. Even extensions to allow the declaration and use of multidimensional arrays whose size is dynamically determined are not entirely straightforward [MacDonald 89] [Ritchie 90], although they would make it much easier to write numerical libraries in C. Thus, C covers the most important uses of strings and arrays resulting from a uniform and simple mechanism in practice but leaves problems for highly efficient implementations and extensions. 

 

There are, of course, many minor infelicities in the language and its description besides those discussed above. There are also general criticisms to be made, which go beyond detailed points. The most important of these is that language and its generally-expected environment are of little help in the writing of very large systems. The naming structure only provides two main levels, 'external' (visible everywhere) and 'internal' (within a single procedure). The intermediate level of visibility (within a single file of data and procedures) is weakly linked to the language definition. There is therefore little direct support for modularization, and project designers are forced to set up their conventions.

 

Similarly, C itself provides two storage duration: 'automatic' objects that exist while the control resides in or below the procedure, and 'static' objects that exist throughout the execution of the program. Off-stack, dynamically allocated storage is provided only by a library routine and the burden of managing it is placed on the programmer: C is hostile to automatic garbage collection.

Thursday, June 25, 2020

Short History of C Programming



Short History of C Programming


HISTORY OF C

There are a lot of programming languages in use today, one of which is C. There are many C programming languages, including Objective-C, C++, and C #. None of these are in the same language. So, how did C get started?

Wednesday, June 24, 2020

WHAT IS THE HISTORY OF C PROGRAMMING LANGUAGE

DESCRIBE ABOUT HISTORY OF C PROGRAMMING LANGUAGE


C Language

       C programming language is a structured programming language, developed by Dennis Ritchie at Bell Laboratories in 1972.

       C language features have been derived from an earlier language called "B" (Basic Combined Programming Language – BCPL).

       In earlier days, the programs were written in assembly level languages. So, it happened that very large programs were written to perform specific tasks using assembly code.

       But the 'B' language could perform the same task in a few program lines, and it was faster than the assembly of the language code.

       However, the B language did not support certain features such as data types and structures, etc. So, this was a drawback to the B language. Dennis Ritchie developed C by keeping most of the B-language and adding many features that produced powerful and effective outputs.

       So, the C language was invented to implement the UNIX operating system. Most of the UNIX components have been rewritten in C.

       In 1978, Dennis Ritchie and Brian Kernighan published the first edition of The C Programming Language, commonly known as K&R C.

       In 1983, the American National Standards Institute ( ANSI) set up a committee to provide a modern, comprehensive definition of C. The resulting definition, ANSI or "ANSI C," was completed at the end of 1988.

       Standard C89 / C90 – The first standardized C-language specification was developed by the American National Standards Institute in 1989. The standards C89 and C90 refer to the same programming language.

       Standard C99 – The next revision was published in 1999 that introduced new futures such as advanced data types and other changes.

       C11 standard adds new features to C and library, such as generic macro types, anonymous structures, enhanced Unicode support, atomic operations, multi-threading, and bound-checked functions. It also makes some parts of the existing C99 library optional and improves compatibility with C++.

Embedded C includes features not available in normal C, such as fixed-point arithmetic, named address spaces, and basic I / O hardware address.

Tuesday, June 23, 2020

What is Computer Languages and its Types

What is Computer Languages and its Types

Computer Language

Introduction of Language

Language is the main medium of communication between computer systems and programming languages are the most common. As we know, the computer only understands binary numbers that are 0 and 1 to perform different operations, but the languages are developed for different types of computer work. The language consists of all instructions to request the task processing system. From the first generation and now the fourth generation of computers, several programming languages have been used to communicate with computers. Here we're going to go into the details of the computer language and its types.

Thursday, June 18, 2020

How to Share Blocked Blog post on Facebook

Step to Share Blocked Blog post on Facebook:


1.Make a new blog on Another account.


2.Link your blog post in new blog's post.If you have a picture than add picture and link with us.



3.Share your new link on Facebook.

   Note: Share only one time.



4.Now share your post in all groups or copy your post's link and share.









Friday, June 5, 2020

What is a Compiler?

What's a compiler?


 The compiler translates the program into the target language in the source language of the program. The most well-known form of compiler is one that translates a high-level language like C into the native assembly language of the machine so that it can be executed. And of course, there are compilers for languages like C++, Java, C #, and Rust, and many more. The same techniques used in a traditional compiler are also used in any program which processes a language. For example, a typing program such as TEX translates a manuscript into a Postscript document. A graphic layout program like Dot consumes a list of nodes and edges and arranges them on a screen. The web browser translates an HTML document into an interactive graphic display. You need to understand and use the same techniques as traditional compilers to write programs like these. Compilers exist not only for translating programs, but also for improving them. The compiler helps the programmer to find errors in the program at compile-time, so that the user does not have to encounter them at runtime. Usually, more strict language results in more time-compile errors. This makes it harder for the programmer to work, but it makes it more likely that the program is correct. For example, the Ada language is infamous among programmers as challenging to write without compile-time errors, but once working, safety-critical systems such as the Boeing 777 aircraft are trusted. The compiler is separate from the interpreter, which reads the program and then executes it directly, without issuing a translation. This is also sometimes referred to as a virtual machine. Languages like Python and Ruby are typically performed by an interpreter who reads the source code directly. Compilers and interpreters are closely linked, and it is sometimes possible to exchange one for another. For example, Java compilers translate Java source code to Java byte code, which is the abstract form of the assembly language. Some Java Virtual Machine implementations work as interpreters, performing one instruction at a time. Others work by translating the byte code into the local machine code and then directly running the machine code. This is known as just in time compiling or JIT compiling.


Climate Crisis and Innovation: Navigating Earth's Future

Climate Change: Recent Events and Technological Solutions 1. The Escalating Climate Crisis The climate crisis has intensified in recent year...