Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Reference (computer science)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Examples== [[Pointer (computer programming)|Pointer]]s are the most primitive type of reference. Due to their intimate relationship with the underlying hardware, they are one of the most powerful and efficient types of references. However, also due to this relationship, pointers require a strong understanding by the programmer of the details of memory architecture. Because pointers store a memory location's address, instead of a value directly, inappropriate use of pointers can lead to [[undefined behavior]] in a program, particularly due to [[dangling pointer]]s or [[wild pointer]]s. [[Smart pointer]]s are [[opaque pointer|opaque data structures]] that act like pointers but can only be accessed through particular methods. A [[Handle (computing)|handle]] is an abstract reference, and may be represented in various ways. A common example are [[file handle]]s (the FILE data structure in the [[stdio|C standard I/O library]]), used to abstract file content. It usually represents both the file itself, as when requesting a [[lock (computer science)|lock]] on the file, and a specific position within the file's content, as when reading a file. In [[distributed computing]], the reference may contain more than an address or identifier; it may also include an embedded specification of the network protocols used to locate and access the referenced object, the way information is encoded or serialized. Thus, for example, a [[web services description language|WSDL]] description of a remote web service can be viewed as a form of reference; it includes a complete specification of how to locate and bind to a particular [[web service]]. 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. In all these cases, the reference includes the full set of instructions, or a recipe, for how to access the data; in this sense, it serves the same purpose as an identifier or address in memory. If we have a set of keys ''K'' and a set of data objects ''D'', any well-defined (single-valued) function from ''K'' to ''D'' βͺ {[[Nullable type|null]]} defines a type of reference, where ''null'' is the image of a key not referring to anything meaningful. An alternative representation of such a function is a directed graph called a [[reachability graph]]. Here, each datum is represented by a vertex and there is an edge from ''u'' to ''v'' if the datum in ''u'' refers to the datum in ''v''. The maximum [[out-degree]] is one. These graphs are valuable in [[garbage collection (computer science)|garbage collection]], where they can be used to separate accessible from [[Unreachable object|inaccessible objects]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)