Naming of pointers in various languages

Source: Internet
Author: User

Without pointers, you cannot construct an orthodox data structure. Therefore, a more mature and Orthodox programming language must have pointers.3.

3 In the past, there were no pointers in FORTRAN, COBOL, and basic, but the pointer function was officially introduced in FORTRAN90, Visual Basic, and other upgraded versions.

Why? How can I hear that Java has no pointers ......

I can tell you responsibly that this is a rumor.

The supplementary content in Chapter 4th also mentioned that Java can only operate arrays and objects through pointers. Therefore, Java is more inseparable from pointers than C.

In the early Java white paper, there was a saying that "Java has no pointer ".4. In Java, the concept of "reference" is equivalent to a pointer in the View of C and Pascal programmers. I think that behind the idea of "Java has no pointer" is the smell of marketing like the following,
4 refer to http://java.sun. com/docs/overviews/Java-Overview-1. html.

For C language, we all think that "Pointers are difficult". If we emphasize "No pointers", it may be easier for new programmers to accept them.

However, Java references differ greatly from C pointers. Java does not have pointer operations, so there is no subtle relationship between pointer operations and arrays. In addition, you cannot obtain pointers to variables. If you think these differences can be the reason for "no pointer in Java", isn't Pascal having no pointer?

In addition to Java, the pointer-like objects in LISP, smalltalk, and Perl (after ver.5) are also referred to as "references", but some people may use "Pointers. That is to say, these languages do not strictly separate "reference" from "pointer. Because they are essentially the same, Java deliberately emphasizes "no pointer", which makes people feel strange.5.

5. The scripting language Ruby, which was born in Japan, was asserted in the author's book that "there is no such concept as pointer in Ruby ", in Ruby, there are also pointers called "references.

The basic types of strings in ruby are not immutable. Is it dangerous for a language like Ruby to "have no pointers?

Pascal, modula2/3, and C are called pointers.

The name in Ada is "access type ". This is a bit confusing.

Sadly, C ++ distinguishes "Pointer" from "Reference" in syntax into two different concepts.

The "pointer" of C ++ is synonymous with the "pointer" of C and Pascal and the "reference" of Java. Second, "Reference" in C ++ refers to the object that should be called "alias" (alias). Because it is an alias, once "what is an alias" is determined ", it cannot be modified any more.

In fact, the term "Reference" in C ++ is also implemented through pointers, so it is actually a repetitive function. Many skilled C ++ programmers often use pointers instead of "references. However, when some operators are overloaded and the constructor is copied, it may have to be used as a reference ". For C ++, some people say that it is too esoteric. Some people say that it is too costly to use it to develop projects. Some people may even question whether there is a person who understands the full picture of C ++ "...... In short, C ++ is also a tangled development language.

This article is excerpted from conquer the C pointer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.