Reference (computer science)

referencereferencesHandlepointersAddressde-referencede-referenceddereferencedlinklinking
In computer science, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device.wikipedia
178 Related Articles

Handle (computing)

handlehandlesfile handles
However a reference may also be implemented in other ways, such as the offset (difference) between the datum's address and some fixed "base" address, as an index into an array, or more abstractly as a handle.
In computer programming, a handle is an abstract reference to a resource.

Pointer (computer programming)

pointerpointerspointer arithmetic
For this reason, a reference is often erroneously confused with a pointer or address, and is said to "point to" the data.
A pointer is a simple, more concrete implementation of the more abstract reference data type.

Linked list

singly linked listlinked listsdynamic list
This idea is the basis of indirect addressing and of many linked data structures, such as linked lists. This simple structure is most commonly used to build singly linked lists, but can also be used to build simple binary trees and so-called "dotted lists", which terminate not with a null reference but a value.
In its most basic form, each node contains: data, and a reference (in other words, a link) to the next node in the sequence.

Linked data structure

linked data structuresconnectorConnector (computer science)
This idea is the basis of indirect addressing and of many linked data structures, such as linked lists.
In computer science, a linked data structure is a data structure which consists of a set of data records (nodes) linked together and organized by references (links or pointers).

Dangling pointer

wild pointerdangling referenceuse-after-free
References can cause significant complexity in a program, partially due to the possibility of dangling and wild references and partially because the topology of data with references is a directed graph, whose analysis can be quite complicated.
More generally, dangling references and wild references are references that do not resolve to a valid destination, and include such phenomena as link rot on the internet.

Opaque pointer

opaque typePimplCheshire Cat idiom
Smart pointers are opaque data structures that act like pointers but can only be accessed through particular methods.
However, they will not be able to de-reference such a pointer, and can only change the object's content by calling some procedure that has the missing information.

Live distributed object

A reference to a live distributed object is another example: it is a complete specification for how to construct a small software component called a proxy that will subsequently engage in a peer-to-peer interaction, and through which the local machine may gain access to data that is replicated or exists only as a weakly consistent message stream.

Unreachable memory

unreachableunreachable objectweakly reachable
These graphs are valuable in garbage collection, where they can be used to separate accessible from inaccessible objects.
Similarly, an unreachable object is a dynamically allocated object that has no reachable reference to it.

Array data structure

arrayarraysvector
However a reference may also be implemented in other ways, such as the offset (difference) between the datum's address and some fixed "base" address, as an index into an array, or more abstractly as a handle.
It uses a one-dimensional array of references to arrays of one dimension less.

Evaluation strategy

call by namecall by valuecall-by-name
For example, the call by reference calling convention can be implemented with either explicit or implicit use of references.
In some cases, the term "call by value" is problematic, as the value which is passed is not the value of the variable as understood by the ordinary meaning of value, but an implementation-specific reference to the value.

Memory management

heapmemory allocationdynamic memory allocation
Internal storage is usually more efficient, because there is a space cost for the references and dynamic allocation metadata, and a time cost associated with dereferencing a reference and with allocating the memory for the smaller objects.
Since the precise location of the allocation is not known in advance, the memory is accessed indirectly, usually through a pointer reference.

Smart pointer

smart pointershandleshared_ptrs
Smart pointers are opaque data structures that act like pointers but can only be accessed through particular methods.

Reference counting

reference countreference countedreference cycle
References are also used in function/method calls or message passing, and reference counts are frequently used to perform garbage collection of unused objects.
In computer science, reference counting is a programming technique of storing the number of references, pointers, or handles to a resource, such as an object, a block of memory, disk space, and others.

Immutable object

immutableimmutabilitymutable
In all of the above settings, the concept of mutable variables, data that can be modified, often makes implicit use of references.
In most object-oriented languages, objects can be referred to using references.

Perl

Perl 5Perl programming languagePerl Script
Some languages, like Perl, support symbolic references, which are just string values that contain the names of variables.
It was a nearly complete rewrite of the interpreter, and it added many new features to the language, including objects, references, lexical (my) variables, and modules.

Weak reference

weakstrongstrong reference
In computer programming, a weak reference is a reference that does not protect the referenced object from collection by a garbage collector, unlike a strong reference.

Variable (computer science)

variablevariablesscalar
In computer science, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device.
The variable name is the usual way to reference the stored value, in addition to referring to the variable itself, depending on the context.

Value type and reference type

value typereference typereference types
A value of reference type is a reference to another value.

Binary tree

complete binary treebinary treesperfect binary tree
This simple structure is most commonly used to build singly linked lists, but can also be used to build simple binary trees and so-called "dotted lists", which terminate not with a null reference but a value.
In a language with records and references, binary trees are typically constructed by having a tree node structure which contains some data and references to its left child and its right child.

Data type

typedatatypetypes
It is similar to the assembly representation of a raw address, except that it carries a static datatype which can be used at compile-time to ensure that the data it refers to is not misinterpreted.
It is a primitive kind of reference.

Computer science

computer scientistcomputer sciencescomputer scientists
In computer science, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device.

Data

statistical datascientific datadatum
In computer science, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device.

Record (computer science)

recordrecordsstruct
In computer science, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device.

Computer

computerscomputer systemdigital computer
In computer science, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device.

Computer memory

memorymemoriesmain memory
In computer science, a reference is a value that enables a program to indirectly access a particular datum, such as a variable's value or a record, in the computer's memory or in some other storage device.