chunk_id
stringlengths 5
8
| chunk
stringlengths 1
1k
|
---|---|
1602_10 | On the other hand, some systems have more units of memory than there are addresses. In this case, a more complex scheme such as memory segmentation or paging is employed to use different parts of the memory at different times. The last incarnations of the x86 architecture support up to 36 bits of physical memory addresses, which were mapped to the 32-bit linear address space through the PAE paging mechanism. Thus, only 1/16 of the possible total memory may be accessed at a time. Another example in the same computer family was the 16-bit protected mode of the 80286 processor, which, though supporting only 16 MB of physical memory, could access up to 1 GB of virtual memory, but the combination of 16-bit address and segment registers made accessing more than 64 KB in one data structure cumbersome. |
1602_11 | In order to provide a consistent interface, some architectures provide memory-mapped I/O, which allows some addresses to refer to units of memory while others refer to device registers of other devices in the computer. There are analogous concepts such as file offsets, array indices, and remote object references that serve some of the same purposes as addresses for other types of objects.
Uses
Pointers are directly supported without restrictions in languages such as PL/I, C, C++, Pascal, FreeBASIC, and implicitly in most assembly languages. They are primarily used for constructing references, which in turn are fundamental to constructing nearly all data structures, as well as in passing data between different parts of a program. |
1602_12 | In functional programming languages that rely heavily on lists, data references are managed abstractly by using primitive constructs like cons and the corresponding elements car and cdr, which can be thought of as specialised pointers to the first and second components of a cons-cell. This gives rise to some of the idiomatic "flavour" of functional programming. By structuring data in such cons-lists, these languages facilitate recursive means for building and processing data—for example, by recursively accessing the head and tail elements of lists of lists; e.g. "taking the car of the cdr of the cdr". By contrast, memory management based on pointer dereferencing in some approximation of an array of memory addresses facilitates treating variables as slots into which data can be assigned imperatively. |
1602_13 | When dealing with arrays, the critical lookup operation typically involves a stage called address calculation which involves constructing a pointer to the desired data element in the array. In other data structures, such as linked lists, pointers are used as references to explicitly tie one piece of the structure to another.
Pointers are used to pass parameters by reference. This is useful if the programmer wants a function's modifications to a parameter to be visible to the function's caller. This is also useful for returning multiple values from a function. |
1602_14 | Pointers can also be used to allocate and deallocate dynamic variables and arrays in memory. Since a variable will often become redundant after it has served its purpose, it is a waste of memory to keep it, and therefore it is good practice to deallocate it (using the original pointer reference) when it is no longer needed. Failure to do so may result in a memory leak (where available free memory gradually, or in severe cases rapidly, diminishes because of an accumulation of numerous redundant memory blocks).
C pointers
The basic syntax to define a pointer is:
int *ptr;
This declares ptr as the identifier of an object of the following type:
pointer that points to an object of type int
This is usually stated more succinctly as "ptr is a pointer to int." |
1602_15 | Because the C language does not specify an implicit initialization for objects of automatic storage duration, care should often be taken to ensure that the address to which ptr points is valid; this is why it is sometimes suggested that a pointer be explicitly initialized to the null pointer value, which is traditionally specified in C with the standardized macro NULL:
int *ptr = NULL;
Dereferencing a null pointer in C produces undefined behavior, which could be catastrophic. However, most implementations simply halt execution of the program in question, usually with a segmentation fault.
However, initializing pointers unnecessarily could hinder program analysis, thereby hiding bugs.
In any case, once a pointer has been declared, the next logical step is for it to point at something:
int a = 5;
int *ptr = NULL;
ptr = &a; |
1602_16 | This assigns the value of the address of a to ptr. For example, if a is stored at memory location of 0x8130 then the value of ptr will be 0x8130 after the assignment. To dereference the pointer, an asterisk is used again:
*ptr = 8;
This means take the contents of ptr (which is 0x8130), "locate" that address in memory and set its value to 8.
If a is later accessed again, its new value will be 8.
This example may be clearer if memory is examined directly.
Assume that a is located at address 0x8130 in memory and ptr at 0x8134; also assume this is a 32-bit machine such that an int is 32-bits wide. The following is what would be in memory after the following code snippet is executed:
int a = 5;
int *ptr = NULL;
{| class="wikitable"
! Address !! Contents
|-
| 0x8130 || 0x00000005
|-
| 0x8134 || 0x00000000
|}
(The NULL pointer shown here is 0x00000000.)
By assigning the address of a to ptr:
ptr = &a;
yields the following memory values: |
1602_17 | {| class="wikitable"
! Address !! Contents
|-
| 0x8130 || 0x00000005
|-
| 0x8134 || 0x00008130
|}
Then by dereferencing ptr by coding:
*ptr = 8;
the computer will take the contents of ptr (which is 0x8130), 'locate' that address, and assign 8 to that location yielding the following memory:
{| class="wikitable"
! Address !! Contents
|-
| 0x8130 || 0x00000008
|-
| 0x8134 || 0x00008130
|}
Clearly, accessing a will yield the value of 8 because the previous instruction modified the contents of a by way of the pointer ptr. |
1602_18 | Use in data structures
When setting up data structures like lists, queues and trees, it is necessary to have pointers to help manage how the structure is implemented and controlled. Typical examples of pointers are start pointers, end pointers, and stack pointers. These pointers can either be absolute (the actual physical address or a virtual address in virtual memory) or relative (an offset from an absolute start address ("base") that typically uses fewer bits than a full address, but will usually require one additional arithmetic operation to resolve). |
1602_19 | Relative addresses are a form of manual memory segmentation, and share many of its advantages and disadvantages. A two-byte offset, containing a 16-bit, unsigned integer, can be used to provide relative addressing for up to 64 KiB (216 bytes) of a data structure. This can easily be extended to 128, 256 or 512 KiB if the address pointed to is forced to be aligned on a half-word, word or double-word boundary (but, requiring an additional "shift left" bitwise operation—by 1, 2 or 3 bits—in order to adjust the offset by a factor of 2, 4 or 8, before its addition to the base address). Generally, though, such schemes are a lot of trouble, and for convenience to the programmer absolute addresses (and underlying that, a flat address space) is preferred. |
1602_20 | A one byte offset, such as the hexadecimal ASCII value of a character (e.g. X'29') can be used to point to an alternative integer value (or index) in an array (e.g., X'01'). In this way, characters can be very efficiently translated from 'raw data' to a usable sequential index and then to an absolute address without a lookup table.
C arrays
In C, array indexing is formally defined in terms of pointer arithmetic; that is, the language specification requires that array[i] be equivalent to *(array + i). Thus in C, arrays can be thought of as pointers to consecutive areas of memory (with no gaps), and the syntax for accessing arrays is identical for that which can be used to dereference pointers. For example, an array array can be declared and used in the following manner: |
1602_21 | int array[5]; /* Declares 5 contiguous integers */
int *ptr = array; /* Arrays can be used as pointers */
ptr[0] = 1; /* Pointers can be indexed with array syntax */
*(array + 1) = 2; /* Arrays can be dereferenced with pointer syntax */
*(1 + array) = 2; /* Pointer addition is commutative */
array[2] = 4; /* Subscript operator is commutative */
This allocates a block of five integers and names the block array, which acts as a pointer to the block. Another common use of pointers is to point to dynamically allocated memory from malloc which returns a consecutive block of memory of no less than the requested size that can be used as an array.
While most operators on arrays and pointers are equivalent, the result of the sizeof operator differs. In this example, sizeof(array) will evaluate to 5*sizeof(int) (the size of the array), while sizeof(ptr) will evaluate to sizeof(int*), the size of the pointer itself.
Default values of an array can be declared like: |
1602_22 | int array[5] = {2, 4, 3, 1, 5};
If array is located in memory starting at address 0x1000 on a 32-bit little-endian machine then memory will contain the following (values are in hexadecimal, like the addresses):
{| class="wikitable" style="font-family:monospace;"
|-
|
! 0 || 1 || 2 || 3
|-
! 1000
| 2 || 0 || 0 || 0
|-
! 1004
| 4 || 0 || 0 || 0
|-
! 1008
| 3 || 0 || 0 || 0
|-
! 100C
| 1 || 0 || 0 || 0
|-
! 1010
| 5 || 0 || 0 || 0
|}
Represented here are five integers: 2, 4, 3, 1, and 5. These five integers occupy 32 bits (4 bytes) each with the least-significant byte stored first (this is a little-endian CPU architecture) and are stored consecutively starting at address 0x1000. |
1602_23 | The syntax for C with pointers is:
array means 0x1000;
array + 1 means 0x1004: the "+ 1" means to add the size of 1 int, which is 4 bytes;
*array means to dereference the contents of array. Considering the contents as a memory address (0x1000), look up the value at that location (0x0002);
array[i] means element number i, 0-based, of array which is translated into *(array + i).
The last example is how to access the contents of array. Breaking it down:
array + i is the memory location of the (i)th element of array, starting at i=0;
*(array + i) takes that memory address and dereferences it to access the value.
C linked list
Below is an example definition of a linked list in C.
/* the empty linked list is represented by NULL
* or some other sentinel value */
#define EMPTY_LIST NULL
struct link {
void *data; /* data of this link */
struct link *next; /* next link; EMPTY_LIST if there is none */
}; |
1602_24 | This pointer-recursive definition is essentially the same as the reference-recursive definition from the Haskell programming language:
data Link a = Nil
| Cons a (Link a)
Nil is the empty list, and Cons a (Link a) is a cons cell of type a with another link also of type a.
The definition with references, however, is type-checked and does not use potentially confusing signal values. For this reason, data structures in C are usually dealt with via wrapper functions, which are carefully checked for correctness.
Pass-by-address using pointers
Pointers can be used to pass variables by their address, allowing their value to be changed. For example, consider the following C code:
/* a copy of the int n can be changed within the function without affecting the calling code */
void passByValue(int n) {
n = 12;
}
/* a pointer m is passed instead. No copy of the value pointed to by m is created */
void passByAddress(int *m) {
*m = 14;
} |
1602_25 | int main(void) {
int x = 3;
/* pass a copy of x's value as the argument */
passByValue(x);
// the value was changed inside the function, but x is still 3 from here on
/* pass x's address as the argument */
passByAddress(&x);
// x was actually changed by the function and is now equal to 14 here
return 0;
}
Dynamic memory allocation
In some programs, the required memory depends on what the user may enter. In such cases the programmer needs to allocate memory dynamically. This is done by allocating memory at the heap rather than on the stack, where variables usually are stored (variables can also be stored in the CPU registers, but that's another matter). Dynamic memory allocation can only be made through pointers, and names (like with common variables) can't be given. |
1602_26 | Pointers are used to store and manage the addresses of dynamically allocated blocks of memory. Such blocks are used to store data objects or arrays of objects. Most structured and object-oriented languages provide an area of memory, called the heap or free store, from which objects are dynamically allocated.
The example C code below illustrates how structure objects are dynamically allocated and referenced. The standard C library provides the function malloc() for allocating memory blocks from the heap. It takes the size of an object to allocate as a parameter and returns a pointer to a newly allocated block of memory suitable for storing the object, or it returns a null pointer if the allocation failed.
/* Parts inventory item */
struct Item {
int id; /* Part number */
char * name; /* Part name */
float cost; /* Cost */
}; |
1602_27 | /* Allocate and initialize a new Item object */
struct Item * make_item(const char *name) {
struct Item * item;
/* Allocate a block of memory for a new Item object */
item = malloc(sizeof(struct Item));
if (item == NULL)
return NULL;
/* Initialize the members of the new Item */
memset(item, 0, sizeof(struct Item));
item->id = -1;
item->name = NULL;
item->cost = 0.0;
/* Save a copy of the name in the new Item */
item->name = malloc(strlen(name) + 1);
if (item->name == NULL) {
free(item);
return NULL;
}
strcpy(item->name, name);
/* Return the newly created Item object */
return item;
}
The code below illustrates how memory objects are dynamically deallocated, i.e., returned to the heap or free store. The standard C library provides the function free() for deallocating a previously allocated memory block and returning it back to the heap. |
1602_28 | /* Deallocate an Item object */
void destroy_item(struct Item *item) {
/* Check for a null object pointer */
if (item == NULL)
return;
/* Deallocate the name string saved within the Item */
if (item->name != NULL) {
free(item->name);
item->name = NULL;
}
/* Deallocate the Item object itself */
free(item);
}
Memory-mapped hardware
On some computing architectures, pointers can be used to directly manipulate memory or memory-mapped devices.
Assigning addresses to pointers is an invaluable tool when programming microcontrollers. Below is a simple example declaring a pointer of type int and initialising it to a hexadecimal address in this example the constant 0x7FFF:
int *hardware_address = (int *)0x7FFF; |
1602_29 | In the mid 80s, using the BIOS to access the video capabilities of PCs was slow. Applications that were display-intensive typically used to access CGA video memory directly by casting the hexadecimal constant 0xB8000 to a pointer to an array of 80 unsigned 16-bit int values. Each value consisted of an ASCII code in the low byte, and a colour in the high byte. Thus, to put the letter 'A' at row 5, column 2 in bright white on blue, one would write code like the following:
#define VID ((unsigned short (*)[80])0xB8000)
void foo(void) {
VID[4][1] = 0x1F00 | 'A';
}
Use in control tables |
1602_30 | Control tables that are used to control program flow usually make extensive use of pointers. The pointers, usually embedded in a table entry, may, for instance, be used to hold the entry points to subroutines to be executed, based on certain conditions defined in the same table entry. The pointers can however be simply indexes to other separate, but associated, tables comprising an array of the actual addresses or the addresses themselves (depending upon the programming language constructs available). They can also be used to point to earlier table entries (as in loop processing) or forward to skip some table entries (as in a switch or "early" exit from a loop). For this latter purpose, the "pointer" may simply be the table entry number itself and can be transformed into an actual address by simple arithmetic. |
1602_31 | Typed pointers and casting
In many languages, pointers have the additional restriction that the object they point to has a specific type. For example, a pointer may be declared to point to an integer; the language will then attempt to prevent the programmer from pointing it to objects which are not integers, such as floating-point numbers, eliminating some errors.
For example, in C
int *money;
char *bags;
money would be an integer pointer and bags would be a char pointer.
The following would yield a compiler warning of "assignment from incompatible pointer type" under GCC
bags = money;
because money and bags were declared with different types.
To suppress the compiler warning, it must be made explicit that you do indeed wish to make the assignment by typecasting it
bags = (char *)money;
which says to cast the integer pointer of money to a char pointer and assign to bags. |
1602_32 | A 2005 draft of the C standard requires that casting a pointer derived from one type to one of another type should maintain the alignment correctness for both types (6.3.2.3 Pointers, par. 7):
char *external_buffer = "abcdef";
int *internal_data;
internal_data = (int *)external_buffer; // UNDEFINED BEHAVIOUR if "the resulting pointer
// is not correctly aligned" |
1602_33 | In languages that allow pointer arithmetic, arithmetic on pointers takes into account the size of the type. For example, adding an integer number to a pointer produces another pointer that points to an address that is higher by that number times the size of the type. This allows us to easily compute the address of elements of an array of a given type, as was shown in the C arrays example above. When a pointer of one type is cast to another type of a different size, the programmer should expect that pointer arithmetic will be calculated differently. In C, for example, if the money array starts at 0x2000 and sizeof(int) is 4 bytes whereas sizeof(char) is 1 byte, then money + 1 will point to 0x2004, but bags + 1 would point to 0x2001. Other risks of casting include loss of data when "wide" data is written to "narrow" locations (e.g. bags[0] = 65537;), unexpected results when bit-shifting values, and comparison problems, especially with signed vs unsigned values. |
1602_34 | Although it is impossible in general to determine at compile-time which casts are safe, some languages store run-time type information which can be used to confirm that these dangerous casts are valid at runtime. Other languages merely accept a conservative approximation of safe casts, or none at all.
Value of pointers
In C and C++, the result of comparison between pointers is undefined. In these languages and LLVM, the rule is interpreted to mean that "just because two pointers point to the same address, does not mean they are equal and can be used interchangeably", the difference between the pointers referred to as their provenance. Although casting to an integer type such as uintptr_t offers comparison, the cast itself is implementation-defined. In addition, further conversion to bytes and arithmetic will throw off optimizers trying to keep track the use of pointers, a problem still being elucidated in academic research. |
1602_35 | Making pointers safer
As a pointer allows a program to attempt to access an object that may not be defined, pointers can be the origin of a variety of programming errors. However, the usefulness of pointers is so great that it can be difficult to perform programming tasks without them. Consequently, many languages have created constructs designed to provide some of the useful features of pointers without some of their pitfalls, also sometimes referred to as pointer hazards. In this context, pointers that directly address memory (as used in this article) are referred to as s, by contrast with smart pointers or other variants. |
1602_36 | One major problem with pointers is that as long as they can be directly manipulated as a number, they can be made to point to unused addresses or to data which is being used for other purposes. Many languages, including most functional programming languages and recent imperative languages like Java, replace pointers with a more opaque type of reference, typically referred to as simply a reference, which can only be used to refer to objects and not manipulated as numbers, preventing this type of error. Array indexing is handled as a special case.
A pointer which does not have any address assigned to it is called a wild pointer. Any attempt to use such uninitialized pointers can cause unexpected behavior, either because the initial value is not a valid address, or because using it may damage other parts of the program. The result is often a segmentation fault, storage violation or wild branch (if used as a function pointer or branch address). |
1602_37 | In systems with explicit memory allocation, it is possible to create a dangling pointer by deallocating the memory region it points into. This type of pointer is dangerous and subtle because a deallocated memory region may contain the same data as it did before it was deallocated but may be then reallocated and overwritten by unrelated code, unknown to the earlier code. Languages with garbage collection prevent this type of error because deallocation is performed automatically when there are no more references in scope.
Some languages, like C++, support smart pointers, which use a simple form of reference counting to help track allocation of dynamic memory in addition to acting as a reference. In the absence of reference cycles, where an object refers to itself indirectly through a sequence of smart pointers, these eliminate the possibility of dangling pointers and memory leaks. Delphi strings support reference counting natively. |
1602_38 | The Rust programming language introduces a borrow checker, pointer lifetimes, and an optimisation based around optional types for null pointers to eliminate pointer bugs, without resorting to garbage collection.
Special kinds of pointers
Kinds defined by value
Null pointer
A null pointer has a value reserved for indicating that the pointer does not refer to a valid object. Null pointers are routinely used to represent conditions such as the end of a list of unknown length or the failure to perform some action; this use of null pointers can be compared to nullable types and to the Nothing value in an option type.
Dangling pointer
A dangling pointer is a pointer that does not point to a valid object and consequently may make a program crash or behave oddly. In the Pascal or C programming languages, pointers that are not specifically initialized may point to unpredictable addresses in memory.
The following example code shows a dangling pointer: |
1602_39 | int func(void) {
char *p1 = malloc(sizeof(char)); /* (undefined) value of some place on the heap */
char *p2; /* dangling (uninitialized) pointer */
*p1 = 'a'; /* This is OK, assuming malloc() has not returned NULL. */
*p2 = 'b'; /* This invokes undefined behavior */
}
Here, p2 may point to anywhere in memory, so performing the assignment *p2 = 'b'; can corrupt an unknown area of memory or trigger a segmentation fault.
Wild branch
Where a pointer is used as the address of the entry point to a program or start of a function which doesn't return anything and is also either uninitialized or corrupted, if a call or jump is nevertheless made to this address, a "wild branch" is said to have occurred. In other words, a wild branch is a function pointer that is wild (dangling). |
1602_40 | The consequences are usually unpredictable and the error may present itself in several different ways depending upon whether or not the pointer is a "valid" address and whether or not there is (coincidentally) a valid instruction (opcode) at that address. The detection of a wild branch can present one of the most difficult and frustrating debugging exercises since much of the evidence may already have been destroyed beforehand or by execution of one or more inappropriate instructions at the branch location. If available, an instruction set simulator can usually not only detect a wild branch before it takes effect, but also provide a complete or partial trace of its history.
Kinds defined by structure |
1602_41 | Autorelative pointer
An autorelative pointer is a pointer whose value is interpreted as an offset from the address of the pointer itself; thus, if a data structure has an autorelative pointer member that points to some portion of the data structure itself, then the data structure may be relocated in memory without having to update the value of the auto relative pointer.
The cited patent also uses the term self-relative pointer to mean the same thing. However, the meaning of that term has been used in other ways:
to mean an offset from the address of a structure rather than from the address of the pointer itself;
to mean a pointer containing its own address, which can be useful for reconstructing in any arbitrary region of memory a collection of data structures that point to each other. |
1602_42 | Based pointer
A based pointer is a pointer whose value is an offset from the value of another pointer. This can be used to store and load blocks of data, assigning the address of the beginning of the block to the base pointer.
Kinds defined by use or datatype
Multiple indirection
In some languages, a pointer can reference another pointer, requiring multiple dereference operations to get to the original value. While each level of indirection may add a performance cost, it is sometimes necessary in order to provide correct behavior for complex data structures. For example, in C it is typical to define a linked list in terms of an element that contains a pointer to the next element of the list:
struct element {
struct element *next;
int value;
};
struct element *head = NULL; |
1602_43 | This implementation uses a pointer to the first element in the list as a surrogate for the entire list. If a new value is added to the beginning of the list, head has to be changed to point to the new element. Since C arguments are always passed by value, using double indirection allows the insertion to be implemented correctly, and has the desirable side-effect of eliminating special case code to deal with insertions at the front of the list:
// Given a sorted list at *head, insert the element item at the first
// location where all earlier elements have lesser or equal value.
void insert(struct element **head, struct element *item) {
struct element **p; // p points to a pointer to an element
for (p = head; *p != NULL; p = &(*p)->next) {
if (item->value <= (*p)->value)
break;
}
item->next = *p;
*p = item;
}
// Caller does this:
insert(&head, item); |
1602_44 | In this case, if the value of item is less than that of head, the caller's head is properly updated to the address of the new item.
A basic example is in the argv argument to the main function in C (and C++), which is given in the prototype as char **argv—this is because the variable argv itself is a pointer to an array of strings (an array of arrays), so *argv is a pointer to the 0th string (by convention the name of the program), and **argv is the 0th character of the 0th string.
Function pointer
In some languages, a pointer can reference executable code, i.e., it can point to a function, method, or procedure. A function pointer will store the address of a function to be invoked. While this facility can be used to call functions dynamically, it is often a favorite technique of virus and other malicious software writers.
int sum(int n1, int n2) { // Function with two integer parameters returning an integer value
return n1 + n2;
} |
1602_45 | int main(void) {
int a, b, x, y;
int (*fp)(int, int); // Function pointer which can point to a function like sum
fp = ∑ // fp now points to function sum
x = (*fp)(a, b); // Calls function sum with arguments a and b
y = sum(a, b); // Calls function sum with arguments a and b
}
Back pointer
In doubly linked lists or tree structures, a back pointer held on an element 'points back' to the item referring to the current element. These are useful for navigation and manipulation, at the expense of greater memory use.
Simulation using an array index
It is possible to simulate pointer behavior using an index to an (normally one-dimensional) array. |
1602_46 | Primarily for languages which do not support pointers explicitly but do support arrays, the array can be thought of and processed as if it were the entire memory range (within the scope of the particular array) and any index to it can be thought of as equivalent to a general purpose register in assembly language (that points to the individual bytes but whose actual value is relative to the start of the array, not its absolute address in memory).
Assuming the array is, say, a contiguous 16 megabyte character data structure, individual bytes (or a string of contiguous bytes within the array) can be directly addressed and manipulated using the name of the array with a 31 bit unsigned integer as the simulated pointer (this is quite similar to the C arrays example shown above). Pointer arithmetic can be simulated by adding or subtracting from the index, with minimal additional overhead compared to genuine pointer arithmetic. |
1602_47 | It is even theoretically possible, using the above technique, together with a suitable instruction set simulator to simulate any machine code or the intermediate (byte code) of any processor/language in another language that does not support pointers at all (for example Java / JavaScript). To achieve this, the binary code can initially be loaded into contiguous bytes of the array for the simulator to "read", interpret and action entirely within the memory contained of the same array.
If necessary, to completely avoid buffer overflow problems, bounds checking can usually be actioned for the compiler (or if not, hand coded in the simulator).
Support in various programming languages |
1602_48 | Ada
Ada is a strongly typed language where all pointers are typed and only safe type conversions are permitted. All pointers are by default initialized to null, and any attempt to access data through a null pointer causes an exception to be raised. Pointers in Ada are called access types. Ada 83 did not permit arithmetic on access types (although many compiler vendors provided for it as a non-standard feature), but Ada 95 supports “safe” arithmetic on access types via the package System.Storage_Elements.
BASIC
Several old versions of BASIC for the Windows platform had support for STRPTR() to return the address of a string, and for VARPTR() to return the address of a variable. Visual Basic 5 also had support for OBJPTR() to return the address of an object interface, and for an ADDRESSOF operator to return the address of a function. The types of all of these are integers, but their values are equivalent to those held by pointer types. |
1602_49 | Newer dialects of BASIC, such as FreeBASIC or BlitzMax, have exhaustive pointer implementations, however. In FreeBASIC, arithmetic on ANY pointers (equivalent to C's void*) are treated as though the ANY pointer was a byte width. ANY pointers cannot be dereferenced, as in C. Also, casting between ANY and any other type's pointers will not generate any warnings.
dim as integer f = 257
dim as any ptr g = @f
dim as integer ptr i = g
assert(*i = 257)
assert( (g + 4) = (@f + 1) ) |
1602_50 | C and C++
In C and C++ pointers are variables that store addresses and can be null. Each pointer has a type it points to, but one can freely cast between pointer types (but not between a function pointer and an object pointer). A special pointer type called the “void pointer” allows pointing to any (non-function) object, but is limited by the fact that it cannot be dereferenced directly (it shall be cast). The address itself can often be directly manipulated by casting a pointer to and from an integral type of sufficient size, though the results are implementation-defined and may indeed cause undefined behavior; while earlier C standards did not have an integral type that was guaranteed to be large enough, C99 specifies the uintptr_t typedef name defined in <stdint.h>, but an implementation need not provide it. |
1602_51 | C++ fully supports C pointers and C typecasting. It also supports a new group of typecasting operators to help catch some unintended dangerous casts at compile-time. Since C++11, the C++ standard library also provides smart pointers (unique_ptr, shared_ptr and weak_ptr) which can be used in some situations as a safer alternative to primitive C pointers. C++ also supports another form of reference, quite different from a pointer, called simply a reference or reference type. |
1602_52 | Pointer arithmetic, that is, the ability to modify a pointer's target address with arithmetic operations (as well as magnitude comparisons), is restricted by the language standard to remain within the bounds of a single array object (or just after it), and will otherwise invoke undefined behavior. Adding or subtracting from a pointer moves it by a multiple of the size of its datatype. For example, adding 1 to a pointer to 4-byte integer values will increment the pointer's pointed-to byte-address by 4. This has the effect of incrementing the pointer to point at the next element in a contiguous array of integers—which is often the intended result. Pointer arithmetic cannot be performed on void pointers because the void type has no size, and thus the pointed address can not be added to, although gcc and other compilers will perform byte arithmetic on void* as a non-standard extension, treating it as if it were char *. |
1602_53 | Pointer arithmetic provides the programmer with a single way of dealing with different types: adding and subtracting the number of elements required instead of the actual offset in bytes. (Pointer arithmetic with char * pointers uses byte offsets, because sizeof(char) is 1 by definition.) In particular, the C definition explicitly declares that the syntax a[n], which is the n-th element of the array a, is equivalent to *(a + n), which is the content of the element pointed by a + n. This implies that n[a] is equivalent to a[n], and one can write, e.g., a[3] or 3[a] equally well to access the fourth element of an array a. |
1602_54 | While powerful, pointer arithmetic can be a source of computer bugs. It tends to confuse novice programmers, forcing them into different contexts: an expression can be an ordinary arithmetic one or a pointer arithmetic one, and sometimes it is easy to mistake one for the other. In response to this, many modern high-level computer languages (for example Java) do not permit direct access to memory using addresses. Also, the safe C dialect Cyclone addresses many of the issues with pointers. See C programming language for more discussion.
The void pointer, or void*, is supported in ANSI C and C++ as a generic pointer type. A pointer to void can store the address of any object (not function), and, in C, is implicitly converted to any other object pointer type on assignment, but it must be explicitly cast if dereferenced.
K&R C used char* for the “type-agnostic pointer” purpose (before ANSI C). |
1602_55 | int x = 4;
void* p1 = &x;
int* p2 = p1; // void* implicitly converted to int*: valid C, but not C++
int a = *p2;
int b = *(int*)p1; // when dereferencing inline, there is no implicit conversion
C++ does not allow the implicit conversion of void* to other pointer types, even in assignments. This was a design decision to avoid careless and even unintended casts, though most compilers only output warnings, not errors, when encountering other casts.
int x = 4;
void* p1 = &x;
int* p2 = p1; // this fails in C++: there is no implicit conversion from void*
int* p3 = (int*)p1; // C-style cast
int* p4 = static_cast<int*>(p1); // C++ cast
In C++, there is no void& (reference to void) to complement void* (pointer to void), because references behave like aliases to the variables they point to, and there can never be a variable whose type is void. |
1602_56 | Pointer declaration syntax overview
These pointer declarations cover most variants of pointer declarations. Of course it is possible to have triple pointers, but the main principles behind a triple pointer already exist in a double pointer.
char cff [5][5]; /* array of arrays of chars */
char *cfp [5]; /* array of pointers to chars */
char **cpp; /* pointer to pointer to char ("double pointer") */
char (*cpf) [5]; /* pointer to array(s) of chars */
char *cpF(); /* function which returns a pointer to char(s) */
char (*CFp)(); /* pointer to a function which returns a char */
char (*cfpF())[5]; /* function which returns pointer to an array of chars */
char (*cpFf[5])(); /* an array of pointers to functions which return a char */
The () and [] have a higher priority than *. |
1602_57 | C#
In the C# programming language, pointers are supported only under certain conditions: any block of code including pointers must be marked with the unsafe keyword. Such blocks usually require higher security permissions to be allowed to run.
The syntax is essentially the same as in C++, and the address pointed can be either managed or unmanaged memory. However, pointers to managed memory (any pointer to a managed object) must be declared using the fixed keyword, which prevents the garbage collector from moving the pointed object as part of memory management while the pointer is in scope, thus keeping the pointer address valid.
An exception to this is from using the IntPtr structure, which is a safe managed equivalent to int*, and does not require unsafe code. This type is often returned when using methods from the System.Runtime.InteropServices, for example: |
1602_58 | // Get 16 bytes of memory from the process's unmanaged memory
IntPtr pointer = System.Runtime.InteropServices.Marshal.AllocHGlobal(16);
// Do something with the allocated memory
// Free the allocated memory
System.Runtime.InteropServices.Marshal.FreeHGlobal(pointer);
The .NET framework includes many classes and methods in the System and System.Runtime.InteropServices namespaces (such as the Marshal class) which convert .NET types (for example, System.String) to and from many unmanaged types and pointers (for example, LPWSTR or void*) to allow communication with unmanaged code. Most such methods have the same security permission requirements as unmanaged code, since they can affect arbitrary places in memory. |
1602_59 | COBOL
The COBOL programming language supports pointers to variables. Primitive or group (record) data objects declared within the LINKAGE SECTION of a program are inherently pointer-based, where the only memory allocated within the program is space for the address of the data item (typically a single memory word). In program source code, these data items are used just like any other WORKING-STORAGE variable, but their contents are implicitly accessed indirectly through their LINKAGE pointers.
Memory space for each pointed-to data object is typically allocated dynamically using external CALL statements or via embedded extended language constructs such as EXEC CICS or EXEC SQL statements.
Extended versions of COBOL also provide pointer variables declared with USAGE IS POINTER clauses. The values of such pointer variables are established and modified using SET and SET ADDRESS statements. |
1602_60 | Some extended versions of COBOL also provide PROCEDURE-POINTER variables, which are capable of storing the addresses of executable code. |
1602_61 | PL/I
The PL/I language provides full support for pointers to all data types (including pointers to structures), recursion, multitasking, string handling, and extensive built-in functions. PL/I was quite a leap forward compared to the programming languages of its time. PL/I pointers are untyped, and therefore no casting is required for pointer dereferencing or assignment. The declaration syntax for a pointer is DECLARE xxx POINTER;, which declares a pointer named "xxx". Pointers are used with BASED variables. A based variable can be declared with a default locator (DECLARE xxx BASED(ppp); or without (DECLARE xxx BASED;), where xxx is a based variable, which may be an element variable, a structure, or an array, and ppp is the default pointer). Such a variable can be address without an explicit pointer reference (xxx=1;, or may be addressed with an explicit reference to the default locator (ppp), or to any other pointer (qqq->xxx=1;). |
1602_62 | Pointer arithmetic is not part of the PL/I standard, but many compilers allow expressions of the form ptr = ptr±expression. IBM PL/I also has the builtin function PTRADD to perform the arithmetic. Pointer arithmetic is always performed in bytes.
IBM Enterprise PL/I compilers have a new form of typed pointer called a HANDLE.
D
The D programming language is a derivative of C and C++ which fully supports C pointers and C typecasting.
Eiffel
The Eiffel object-oriented language employs value and reference semantics without pointer arithmetic. Nevertheless, pointer classes are provided. They offer pointer arithmetic, typecasting, explicit memory management,
interfacing with non-Eiffel software, and other features. |
1602_63 | Fortran
Fortran-90 introduced a strongly typed pointer capability. Fortran pointers contain more than just a simple memory address. They also encapsulate the lower and upper bounds of array dimensions, strides (for example, to support arbitrary array sections), and other metadata. An association operator, => is used to associate a POINTER to a variable which has a TARGET attribute. The Fortran-90 ALLOCATE statement may also be used to associate a pointer to a block of memory. For example, the following code might be used to define and create a linked list structure:
type real_list_t
real :: sample_data(100)
type (real_list_t), pointer :: next => null ()
end type
type (real_list_t), target :: my_real_list
type (real_list_t), pointer :: real_list_temp
real_list_temp => my_real_list
do
read (1,iostat=ioerr) real_list_temp%sample_data
if (ioerr /= 0) exit
allocate (real_list_temp%next)
real_list_temp => real_list_temp%next
end do |
1602_64 | Fortran-2003 adds support for procedure pointers. Also, as part of the C Interoperability feature, Fortran-2003 supports intrinsic functions for converting C-style pointers into Fortran pointers and back.
Go
Go has pointers. Its declaration syntax is equivalent to that of C, but written the other way around, ending with the type. Unlike C, Go has garbage collection, and disallows pointer arithmetic. Reference types, like in C++, do not exist. Some built-in types, like maps and channels, are boxed (i.e. internally they are pointers to mutable structures), and are initialized using the make function. In an approach to unified syntax between pointers and non-pointers, the arrow (->) operator has been dropped: the dot operator on a pointer refers to the field or method of the dereferenced object. This, however, only works with 1 level of indirection. |
1602_65 | Java
There is no explicit representation of pointers in Java. Instead, more complex data structures like objects and arrays are implemented using references. The language does not provide any explicit pointer manipulation operators. It is still possible for code to attempt to dereference a null reference (null pointer), however, which results in a run-time exception being thrown. The space occupied by unreferenced memory objects is recovered automatically by garbage collection at run-time.
Modula-2
Pointers are implemented very much as in Pascal, as are VAR parameters in procedure calls. Modula-2 is even more strongly typed than Pascal, with fewer ways to escape the type system. Some of the variants of Modula-2 (such as Modula-3) include garbage collection. |
1602_66 | Oberon
Much as with Modula-2, pointers are available. There are still fewer ways to evade the type system and so Oberon and its variants are still safer with respect to pointers than Modula-2 or its variants. As with Modula-3, garbage collection is a part of the language specification. |
1602_67 | Pascal
Unlike many languages that feature pointers, standard ISO Pascal only allows pointers to reference dynamically created variables that are anonymous and does not allow them to reference standard static or local variables. It does not have pointer arithmetic. Pointers also must have an associated type and a pointer to one type is not compatible with a pointer to another type (e.g. a pointer to a char is not compatible with a pointer to an integer). This helps eliminate the type security issues inherent with other pointer implementations, particularly those used for PL/I or C. It also removes some risks caused by dangling pointers, but the ability to dynamically let go of referenced space by using the dispose standard procedure (which has the same effect as the free library function found in C) means that the risk of dangling pointers has not been entirely eliminated. |
1602_68 | However, in some commercial and open source Pascal (or derivatives) compiler implementations —like Free Pascal, Turbo Pascal or the Object Pascal in Embarcadero Delphi— a pointer is allowed to reference standard static or local variables and can be cast from one pointer type to another. Moreover, pointer arithmetic is unrestricted: adding or subtracting from a pointer moves it by that number of bytes in either direction, but using the Inc or Dec standard procedures with it moves the pointer by the size of the data type it is declared to point to. An untyped pointer is also provided under the name Pointer, which is compatible with other pointer types. |
1602_69 | Perl
The Perl programming language supports pointers, although rarely used, in the form of the pack and unpack functions. These are intended only for simple interactions with compiled OS libraries. In all other cases, Perl uses references, which are typed and do not allow any form of pointer arithmetic. They are used to construct complex data structures.
See also
Address constant
Bounded pointer
Buffer overflow
Fat pointer
Function pointer
Hazard pointer
Opaque pointer
Pointer swizzling
Reference (computer science)
Static program analysis
Storage violation
Tagged pointer
Variable (computer science)
Zero-based numbering
Iterator
References
External links |
1602_70 | PL/I List Processing Paper from the June, 1967 issue of CACM
cdecl.org A tool to convert pointer declarations to plain English
Over IQ.com A beginner level guide describing pointers in a plain English.
Pointers and Memory Introduction to pointers – Stanford Computer Science Education Library
Pointers in C programming A visual model for the beginners in C programming
0pointer.de A terse list of minimum length source codes that dereference a null pointer in several different programming languages
"The C book" – containing pointer examples in ANSI C
.
Articles with example C code
Data types
Primitive types
American inventions
sv:Datatyp#Pekare och referenstyper |
1603_0 | is a Japanese anime television series animated by AIC and produced by Pioneer LDC. It is loosely based on the first six episodes of the Tenchi Muyo! Ryo-Ohki OVA series. The series premiered on April 2, 1995 in Japan and concluded its airing on September 24, 1995. The series aired in the United States on Cartoon Network's cartoon block Toonami on July 20, 2000 and ended on August 24, 2000. Two featured films came from this canon, Tenchi the Movie: Tenchi Muyo in Love and Tenchi Forever! The Movie. Funimation announced distribution of the series, along with several other Tenchi properties, on July 2, 2010 at Anime Expo. |
1603_1 | This series introduces three new characters: Mihoshi's partner Kiyone Makibi (who debuted in the "Mihoshi Special"), the bounty hunter and Ryoko's rival, Nagi, and her cabbit companion, Ken-Ohki. The series also gave some characters different personalities; Washu is now portrayed as a mildly-insane egomaniac with two pop-up dolls that proclaim her greatness, and Mihoshi was portrayed as a comic relief character whose constant bumbling, blunders and crying fits would often get the gang into trouble. |
1603_2 | Story
Long ago, a legendary warrior and crown prince of the Juraian Empire, Yosho, disappeared and never to be heard again. Unknown to the Juraian Empire, Yosho never wanted to become a ruler and only wanted a quiet peaceful life; he settled on Earth. He discovered the Misaki Shrine and married the daughter of the Misaki priest, Itsuki Masaki; he would rename himself as Katsuhito Masaki. The two later had a daughter, Lady Achika Masaki, princess of Jurai. She would later marry her high school love, Nobuyuki, and the two had Tenchi. Unfortunately, Achika died from illness one snowy winter; Nobuyuki and Katsuhito helped raise Tenchi in the country side, near the Misaki Family Shrine. Tenchi's life was at first normal, but things quickly changed when intergalactic alien girls started coming into his life. |
1603_3 | At 17, Tenchi's life was dramatically changed by the appearance of Space Pirate Ryoko. Evading the Galaxy Police (GXP), Ryoko was piloting her spaceship and cabbit, Ryo-Ohki, and battled with GXP officer Mihoshi when both crash-landed near Tenchi's home. Tenchi found an unconscious Ryoko and tended to her. When she awakened, she gave a fantastic story of how she's being pursued by a terrible space pirate, temporarily earning the Misaki family's trust and gaining their shelter. However, Ryoko's lies easily fell apart when it was discovered her pursuer was actually the GXP and Ryoko is the true pirate. Unfortunately, with Mihoshi's ship destroyed, it was pointless to arrest Ryoko; both girls stayed at the hospitality of the Misaki house. |
1603_4 | Desiring to return home, Mihoshi activated an emergency beacon and it was detected by Juraian Princess Ayeka. When Ayeka arrived, she was shocked to find her old nemesis, Ryoko, was there. Starting a fight, the two battled each other by ship combat and both lost their ships in battle; Ayeka ended as the recent addition to the Misaki household, along with her robotic wooden guardians, Azaka and Kamidake. Not long, Ayeka's little sister, Princess Sasami, had arrived to rescue her sister. |
1603_5 | It was around this time that Ryoko revealed that her ship can regenerate itself. In her cabbit form, Ryo-Ohki developed a great love for carrots and couldn't get enough of them. By the time Sasami arrived, both Ayeka and Ryoko developed romantic feelings for Tenchi. Reluctant to leave, it was time for everyone to part ways. Unfortunately, Sasami accidentally had a carrot with her and it attracted Ryo-Ohki. The cabbit couldn't resist the lure of the carrot and collided with each other's ships, causing everyone to be stranded on Earth. |
1603_6 | The final two ladies to arrive would be legendary mad scientist Washu and Mihoshi's partner, Kiyone. Washu was imprisoned in a special crystal prison for her crimes of creating time-space devices with devastating effects upon the galaxy. Washu's crystal crash-landed in Japan and the inhabitants founded the Misaki Shrine to prevent people accessing the crystal, correctly assuming it's not a safe object. However, thanks to Ryoko's intervention, she was accidentally freed. She eventually set up two dimensional doorways within the Misaki house, one in a closet allowing her to cross dimensions between her lab and the Misaki family and the other in the bathroom creating a male and a female bathroom to allow privacy. |
1603_7 | Lastly, Kiyone was sent to find Mihoshi. After finding her, the two were assigned to patrol and tour the Solar System; it's a severe downgrade. Both lived away from Tenchi's home and have their own place in the city, but due to Mihoshi's frequent blunders, making a living on Earth and balancing GXP duties was hard and Kiyone curses her fortunes because of it. Despite the occasional flares in battles between Ayeka and Ryoko, life was relatively alright until the Juraian military had come for the princesses. |
1603_8 | Unknown to the princesses, the Juraian royal hierarchy of power was usurped by the sudden return of Yosho; it was actually Kagato in disguise. Yosho and Kagato both battled for the succession of Jurai in the past and Kagato lost. However, with Yosho conveniently missing, Kagato took his place as the long lost direct heir to the throne. Kagato then used his royal authority to have the military arrest and prosecute both princesses in an attempt to solidify his dominance in Jurai. The Juraian military arrived at the shrine and transported the house with everyone except Tenchi, Ryo-ohki, and Katsuhito into a battleship, seconds later, returning everyone except Ryoko and the princesses and shrinking the house and the robots into handheld sizes. However, they used Kiyone's cruiser and Ryo-ohki to free them and were on the run. Although not originally involved, the GXP was also under the influence of the Juraian Empire and Mihoshi managed to learn about the corrupted collusion between the |
1603_9 | GXP and Jurai; it made both Mihoshi and Kiyone fugitives. Framed for crimes of treason and terrorism against the crown, the whole group is on the run from the Juraian Empire and the GXP; they journey to Jurai in attempts to clear their names. |
1603_10 | Being on the run was a difficult process. The group had to escape detection from local authorities on top of the GXP, but also make money in between to cover costs for food, fuel, and repairs to their ship. Washu was able to restore the robots to original size and operation as well as the house within the cargo hold of the ship, which served as the main area, excluding the cockpit, for the entire crew(same as it had on Earth).Things were often complicated due to Mihoshi's constant blundering nature as well as Ryoko's selfish nature. On top of that, Ryoko is also evading a long rival, Space Hunter Nagi, while committing major thefts to help sustain the group. However, the group managed to make it to the inner Juraian System. |
1603_11 | Disguising their ship and themselves as a school group, the team had success infiltrating Juraian security thanks to Washu's anti-detection measures; it was once again fumbled by Mihoshi. Nearly unable to escape, the group was secretly aided by a loyalist to escape. While on their way to Jurai, Mihoshi's clumsy nature got them detected by a Jurian warship. However, Katsuhito instructed the crew how to escape capture: by entering a forbidden Juraian planet. Because it's a sacred place that nobody is allowed except Juraian royalty, their pursuers was forced to stand down until permitted entry. In order to take back Jurai, the team is going to need powerful warriors. Yosho decided to resurrect two legendary Juraian knights, the real bodies of Azaka and Kamidake, to aid in their quest. Although the Juraian knights have returned, their robotic counterparts were deactivated to bring them back. It was there that Katsuhito revealed himself as the true Yosho and the knights pledged loyalty to |
1603_12 | Yosho as their king. |
1603_13 | It was at a Juraian villa that Yosho explained the nature of their enemy, Kagato, and his past. A rival and Juraian heir, Kagato became too obsessed with power and it caused him to abuse his Juraian powers. Yosho was forced to face his rival and defeated him in battle, but didn't kill him. Kagato disappeared into the darkness and it was around the same time that Yosho decided to quietly settle down on Earth. Due to the shame and disgrace of Kagato's actions, the Juraian royalty erased the existence of Kagato, explaining why the princesses never heard about Kagato. However, Yosho's identity also pointed out that Tenchi is a direct heir to Jurai's crown. |
1603_14 | On the eve before facing Kagato, both Tenchi and Ayeka was affected by recent news the most. Tenchi always saw himself as a normal high school boy, not heir to a major power in the galaxy; Ayeka was happy about it. She always knew her vacation on Earth would eventually end and she would have to bid farewell. However, with Tenchi as a direct heir, they can be together at each other's side for a long time, something Ryoko wasn't happy about. However, romantic intentions have to hold as Kagato appeared. |
1603_15 | Kagato appeared for a private rematch with Yosho. Unfortunately, Kagato found a way to maintain his youth and also increased his powers; the aged Yosho lost the battle. Ryoko joined the battle, but was critically injured. Kagato then kidnaps Ayeka and flees. In critical condition, Yosho encouraged Tenchi to face his destiny with courage. Motivated to end the dark reign of Kagato, Tenchi and the royal knights journeyed to Jurai to face Kagato. Still injured from her fight, Ryoko pleaded with Tenchi to run away with her, but he wasn't swayed; Ryoko offered to take the trio to Jurai. |
1603_16 | After Ryo-Ohki crash-landed on Jurai, Tenchi and his guardians stormed the palace. Kagato had his own dark royal knights and they tried to stop Tenchi, but Azaka and Kamidake defeated them both. In between, the rest of the girls managed to hold up the Jurian battle fleet by infecting their computers with a computer virus Washu created. Ryoko was severely injured helping Tenchi, losing a lot of blood, she lost consciousness due to her injuries and her fate unknown. Now at the palace throne, Kagato fought against Tenchi. At first, Tenchi was losing, but the Juraian trees reacted to Tenchi and empowered him to rival Kagato. Theorizing Jurai itself has chosen its own master, Kagato angrily fought against Tenchi and lost; he admitted defeat and died and Tenchi saved Ayeka. |
1603_17 | In the aftermath, there was a great media storm over past events. Everyone accused of crimes against the Juraian Empire have been exonerated. Yosho survived his ordeal and was happily treated by a group of pretty Juraian nurses. Ayeka decided not to punish anyone involved with Kagato, but the conspirators themselves quietly resigned to avoid retribution. Washu's involvement made her an honorary president of the Universal Science Academy and she vowed to use her skills for peace; barely a month later, she was ousted for developing a weapon that could destroy the whole universe. At the GXP, Kiyone got promoted to Detective Sergeant and Mihoshi promoted to Chief Criminal Prevention Officer (albeit avoiding her responsibilities to hang with Kiyone). Azaka and Kamidake are no longer royal guardians, but chose to continue serving the princesses. Their robotic counterparts were resurrected thanks to Washu and returns to Ayeka's side. However, Ryoko's fate remains unknown. |
1603_18 | As for Tenchi, he has no interest in succeeding as Jurai's next ruler; he just wants to return to Earth and live a normal life. However, there was no mention who would fill in the power vacuum. Tenchi resumes life back as it was, but find it hard to adapt after living with so many girls; he misses them. Just as he thought of them, Ryoko appears before him. She affectionately hugs him and declares that she intends to fairly win Tenchi's heart. It was also around this time that Washu decided to return to Earth. Kiyone and Mihoshi returns to Earth as well, taking back their old apartment. Ayeka decides to run away and return to Tenchi's side; Sasami decides to also run off and the guardians joins in as well. The story ends with all the girls coming back into his life once again.
Characters
Major characters
Tenchi Masaki
Ryoko
Ayeka Jurai
Sasami Jurai
Ryo-Ohki
Washu Hakubi
Mihoshi Kuramitsu
Kiyone Makibi |
1603_19 | Other characters
Katsuhito Masaki
Nobuyuki Masaki
Nagi
Kagato
Achika Masaki
Haruna
Minor characters
Ken-Ohki is Nagi's cabbit partner. Like Ryō-Ohki, Ken-Ohki can transform himself into a space battleship, although the configuration and color is slightly different from Ryō-Ohki. And like Ryō-Ohki, Ken-Ohki has developed a love of carrots. Ken-Ohki and Ryō-Ohki also love each other, which complicates Nagi's almost obsessive quest to capture Ryōko. But this love had also saved Nagi from being killed by Ryōko, not to mention aiding Ryōko when she, Tenchi, and the knights Azaka and Kamidake stormed the Jurai palace to save Ayeka. |
1603_20 | This android duplicate of Washū was supposed to be a supplemental worker, imprinted with the mad genius's intellect. But somehow, a single hair from Mihoshi found its way into the transfer unit. It was after an explosion (caused by Mihoshi) that Washū discovered that, instead of Washū's mind, the android gains Mihoshi's mind and temperament. Washū also developed a spare body for Mecha-Washū which she used after Washū self-detonated her original body and the spare body is not equipped with a self-destruct device. The group had a hard time dealing with Mecha-Washū until Kiyone came by, as she knew how Mihoshi's mind works, which enabled her to shut down Mecha-Washū. Mecha-Washū has most of Washū's physical features, but with Mihoshi's ear and eye characteristics, as well as her hairstyle. Eventually Washū tried to create a second Mecha-Washū but Ryō-Ohki somehow caused it to gain her characteristics. |
1603_21 | Mitsuki graduated from the same Galaxy Police Academy class Kiyone graduated from, but at a lower score. She is a very ambitious person, and will stoop to anything to get ahead of Kiyone... even capturing her when Kiyone got implicated in Ayeka's problems with Jurai. At the end of the series, Mitsuki was demoted to being Kiyone's errand girl, following Kiyone's promotion to Detective Sergeant and Mihoshi's promotion to Chief Criminal Prevention Officer. |
1603_22 | Mirei is a mysterious ghost girl whose life before she died is unknown to her, although she has a photograph which is her only clue. When the Yagami stopped in the Sargasso sea of space a.k.a. the ship's graveyard, that was when Mirei's ship appeared before them. She invited Sasami and Ryō-ohki on board, after which the two started to have fun and decided to scare the rest of the group, who had come aboard to look for Sasami. Then after sampling Sasami's memories, Mirei, Sasami, and Ryō-ohki continued to play through things such as an amusement park and a fireworks display. Eventually Sasami realized she had to return to the Yagami as everyone was worried. But as a gift, Sasami and Ryō-ohki's image were added to the photograph to help remember their happiest time together.
and |
1603_23 | Basically, the two of them are runaways, and just happened to steal Kiyone's ship Yagami, (with an unknowing Nobuyuki and Katsuhito on board who were playing Shiogi, a Japanese version of chess) when the Masaki clan stopped at a station to order beef dons. Of course, the two of them didn't know about the trouble the Masakis were in, and soon found themselves chased by the G.P. and Jurai... something they never counted on! Eventually they ended up flying towards a star, but the Masaki group (minus Ayeka and Sasami) arrived on Ryō-ohki, retaken the ship, and used Washu's calculations to use the sun's gravity to escape. They then sent Amarube and Yura away on an escape pod. |
1603_24 | During the Masaki clan's trip through the Jurai checkpoint, Sagami met Tenchi (disguised as a girl named Tenko) after he went to check-in station. Sagami then went to the Cafe with Sasami and Tenchi, but after Ryōko and Mihoshi came through when Mihoshi's bungling had exposed them, Sagami was able to help slow down some of the guards. Later when Sasami was separated from the group, Sagami knocked out the guards that heard her and then gave Tenchi a staff to fight off the guards, although it exposed Tenchi's true identity to him. It turned out that Sagami was an agent of Sasami and Ayeka's uncle and was helping the group in order for them to make it into Jurai territory. |
1603_25 | While in disguise on Jurai's checkpoint to get into the Jurai territory, Sasami remembered the time when she used to play with her uncle on Jurai. However, her uncle, who was the outpost chief for the checkpoint, easily recognized her through her disguise. He helped weaken the security grid and had his man Sagami assist the Masaki clan in getting away when they were discovered, giving them a chance to escape from the checkpoint into Jurai territory. He also helped rescue Sasami after she was separated from the group and then rendered unconscious by knockout gas; he then got her back to the group safely. It was only after their escape that Sasami saw him as they were leaving and realized that her uncle had helped them escape, and he realized how much Sasami had grown up. It's also implied that he knew the current emperor was not the real Yosho.
and |
1603_26 | Tetta and Tessei are the Juraian knights that served Kagato. The knights Azaka and Kamidake each faced these two knights respectively. Although both Tetta and Tessei were just as skilled as Azaka and Kamidake and had techniques that weren't available in Azaka and Kamidake's time, both of the noble knights pointed out that they, along with their master, lacked the spirit of chivalry. With their courage and nobility, Azaka and Kamidake killed Tetta and Tessei. |
1603_27 | Yōshō's (Katsuhito) wife in the TV series continuity and Achika's mother. Itsuki briefly appears in Episode 22 and Tenchi Forever! The Movie, when Yōshō explains that after he met her shortly after landing on Earth, he changed his name Katsuhito Masaki when he married her. It was because of this that the spirit of Yōshō's deceased love Haruna awoke and felt betrayed, that she would later kidnap Tenchi. Itsuki made a brief appearance at the end of Tenchi Muyo in Love 2 where after Katsuhito said goodbye to Haruna, Itsuki's spirit appeared in her child form and Katsuhito pointed out to her not to be jealous.
Broadcast history
Tenchi Universe was broadcast on TV Tokyo from 2 April 1995 to 24 September 1995. |
1603_28 | The English-dubbed version of Tenchi Universe first appeared on San Jose PBS member station Superstation KTEH (now KQEH) in 1997 in its original, uncut and uncensored form, as part of its Sunday Late-Prime (9pm-after 12) Sci-Fi programming line-up, and was later picked up by Cartoon Network in 2000 for wider broadcast on its Toonami block (US and Europe). The Toonami version was edited for content, and featured custom opening and closing credits.
After Cartoon Network's rights to broadcast the show expired, the now-defunct International Channel picked up the rights to air the dubbed version in 2004.
In South America, a Spanish dub (co-produced in Chile by Cloverway Inc.) was broadcast on Univision, while the Brazilian-Portuguese version was dubbed on Herbert Richers and was broadcast only on FTA channels TV Bandeirantes and Rede 21. |
1603_29 | Music
Background music/score was composed by Seikou Nagaoka.
Opening: Tenchi Muyo! (Japanese and English versions performed by SONIA)
Ending: Ginga de chokuritsu hokô [Walking Tall in the Milky Way] (Up-Walk in the Galaxy) (Japanese version performed by Ai Orikasa and Yumi Takada; English version performed by Diane Michelle)
Notably, Up-Walk in the Galaxy is intended to act like Ryoko and Ayeka singing two versions of the same song, each of them trying to stake their, apparently valid, claim for Tenchi. |
1603_30 | Insert songs
Episode 6: Ai no Ejiki [Victim of Love] (Japanese version performed by Yuko Mizutani and Yuri Amano; English version performed by Ellen Gerstell and Sherry Lynn)
Episode 13: Towa ni towa ni hoshi no yume [Never-ending Dream of Stars] (Forevermore) (Japanese version performed by Ai Orikasa; English version performed by Diane Michelle)
Episode 16: Koi wa Chigai Hōken [Love is Extraterritorial] (Japanese version performed by Ai Orikasa; English version performed by Petrea Burchard) (This song was never played in the Toonami version.)
Ginga ni Imasokari (I'm the Only One) (Japanese version performed by Yumi Takada; English version performed by Jennifer Darling)
Photon, Proton, Synchrotron (Japanese version performed by Yuko Kobayashi; English version performed by Kate T. Vogt)
Episode 26: Ren'ai no jikū [Dimension of Love] (Japanese version performed by Ai Orikasa; English version performed by Diane Michelle)
References
External links |
1603_31 | 1995 anime television series debuts
Adventure anime and manga
Anime International Company
Fantasy anime and manga
TV Tokyo original programming
Funimation
Geneon USA
Harem anime and manga
NBCUniversal Entertainment Japan
Shōnen manga
Tenchi Muyo! spin-offs
Toonami
Television series about princesses |
1604_0 | Kandukondain Kandukondain () is a 2000 Indian Tamil-language romantic drama film directed and co-written by Rajiv Menon. Based on Jane Austen's 1811 novel Sense and Sensibility, it features an ensemble cast of Mammootty, Ajith Kumar, Tabu, Aishwarya Rai and Abbas. Veteran actors Srividya, Raghuvaran and Manivannan play supporting roles. The film's soundtrack was scored by A. R. Rahman and the cinematographer was Ravi K. Chandran.
After several delays, Kandukondain Kandukondain opened to Indian audiences on 5 May 2000 and was successful at the box office. The film was dubbed and released in Telugu as Priyuraalu Pilichindi and the producers released subtitled versions worldwide. The film also won a National Film Award and two Filmfare Awards South, and was featured in international film festivals. |
1604_1 | Plot
The Indian Peace Keeping Force personnel Major Bala, while fighting in the jungles of war-torn Sri Lanka, loses his right leg in an explosion triggered by Tamil militants. Elsewhere, Manohar, a film director, is greeted in a shooting spot by his parents, who want him to marry Swetha, so that he will inherit her family's company. Sisters Sowmya and Meenakshi are part of a close-knit family living in a Chettiar mansion in Karaikudi, Tamil Nadu, with their mother Padma, maternal grandfather Chandrasekhar, maidservant Chinnatha and younger sister Kamala. Sowmya is a school principal while Meenakshi is passionate about classic Tamil poetry, music and dance. Sivagnanam, a friend of Bala, lives with his mother. His mother is having breathing issues, which is fixed as soon as he says the word marriage. After his mother wants to see a marriage, Sivagnanam shows two cats, Raj and Viji, getting married much to her dismay. |
1604_2 | Bala, who now runs a flower business, has become a depressed and alcohol-dependent man since losing his leg but he quits drinking after an argument with Meenakshi, with whom he falls in love and supports her family when in need. At her behest, he stops drinking in exchange for her to learn music, which she does. Meenakshi, who, considers Bala as a friend, falls in love with Srikanth, a charming businessman who shares Meenakshi's interests. Manohar visits Meenakshi's house for a film shoot. Sowmya and Manohar fall in love with each other. |
1604_3 | On his deathbed, Chandrasekhar tries to say something about his will but no-one understands him. After his death, their lawyer breaks open the box and find he has bequeathed all of his property to his younger son Swaminathan, at the time when his elder daughter Padma had eloped and married without his knowledge, but was unable to change the will as he was paralyzed and unable to speak a few years down the lane when his daughter assisted him. Vidya and Sowmya silently submit themselves to Swaminathan and is wife, Lalitha's demands, but Meenakshi is unable to accept the change in lifestyle. Sowmya and her family move to Chennai when they can no longer stand Lalitha's arrogant behaviour upon inheriting the mansion. |
1604_4 | Upon arriving in Chennai, the family struggles and they work as cooks at a local restaurant. While eating a vazhaipoo vada (banana flower vada), Bala and Sivagnanam recognise its taste and immediately go to the kitchen. They are surprised to see such a rich family working tirelessly in the restaurant. After attending several interviews, Sowmya gets a job as a telephone operator at a software company. She is later promoted to a junior programmer due to her qualifications while Meenakshi becomes a playback singer with Bala's help, but keeps searching for Srikanth whom she has lost contact with. After Sowmya's promotion she gets a home loan approved and they are able to buy their own house in an apartment. Meanwhile, Lalitha is sad after Swaminathan dies of electrocution and offers the Chettinad house to Sowmya and her family, who refuse to take the house back. |
1604_5 | In the meanwhile, Srikanth's finance company goes bankrupt and he has to pay back his investors. A minister offers to bail out Srikanth and his company if Srikanth marries his daughter. Srikanth agrees but Meenakshi is shocked and overwhelmed at his hypocrisy. She meets Srikanth and his future wife at the time of her first recording and after recording her first song, Meenakshi falls into an open manhole and is rescued by Bala. Realising Bala's love for her, Meenakshi falls in love with him. |
1604_6 | Manohar's first film project is in disarray and he is thrown out. Manohar while talking to Sowmya's family says the name chosen for the movie was bad attributed the failure to its bad luck. Sowmya who chose the name of the movie translates it her being bad luck to him. For his next project, he plans to make his own action film with Nandhini Varma, a well-known Telugu film actor, as the heroine. Nandhini is superficially attracted to Manohar; rumours of an affair between them spread and his lack of attention to Sowmya hurts her deeply. Bala introduces Meenakshi to Vinod, an army officer, as he does not want Meenakshi to dedicate her life to caring for him because of his missing leg. Meenakshi tells Vinod and his family that she is not interested in him and declares her love to Bala. Manohar's film is a commercial success but when he visits Sowmya's house in Chennai, he finds she is moving to California for her company's project. Manohar and Sowmya tearfully argue and he tries to |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.