PRIMITIVE TYPE
In computer science, 'primitive types' — as distinct from ''composite types'' — are data types provided by a programming language as basic building blocks. Depending on the language and its implementation, primitive types may or may not have a one-to-one correspondence with objects in the computer's memory.
Primitive types are also known as ''built-in types'' or ''basic types''.
The actual range of primitive types that is available is dependent upon the specific programming language that is being used. For example, in C, strings, are a composite data type, whereas in modern dialects of Basic and in JavaScript, they are a primitive data type.
Typical primitive types may include:
★ character (
★ integer (
★ floating-point number (
★ fixed-point number (
★ boolean having the values 'true' and 'false'.
★ reference (also called a ''pointer'' or ''handle''), a small value referring to another object's address in memory, possibly a much larger one.
More sophisticated types which can be primitive include:
★ Tuples in ML, Python
★ Linked lists in Lisp
★ complex numbers in Fortran, C (C99), Lisp, Python
★ rational numbers in Lisp
★ Hash tables in various guises, in Lisp, Python, Lua
★ first class functions, closures, continuations in Functional programming languages such as Lisp and ML
One usually expects operations on primitive types to be the fastest language constructs there are. Integer addition, for example, can be performed as a single machine instruction, and some processors offer specific instructions to process sequences of characters with a single instruction. In particular, the C standard mentions that
"a'plain' int object has the natural size suggested by the architecture of the
execution environment". This means that
architecture.
Most languages do not allow the behaviour or capabilities of primitive types to be modified by programs. Exceptions include Smalltalk, which permits primitive datatypes to be extended within a program, adding to the operations that can be performed on them or even redefining the built-in operations.
Primitive types are also known as ''built-in types'' or ''basic types''.
The actual range of primitive types that is available is dependent upon the specific programming language that is being used. For example, in C, strings, are a composite data type, whereas in modern dialects of Basic and in JavaScript, they are a primitive data type.
Typical primitive types may include:
★ character (
character, char);★ integer (
integer, int, short, long, byte) with a variety of precisions;★ floating-point number (
float, double, real, double precision);★ fixed-point number (
fixed) with a variety of precisions and a programmer-selected scale.★ boolean having the values 'true' and 'false'.
★ reference (also called a ''pointer'' or ''handle''), a small value referring to another object's address in memory, possibly a much larger one.
More sophisticated types which can be primitive include:
★ Tuples in ML, Python
★ Linked lists in Lisp
★ complex numbers in Fortran, C (C99), Lisp, Python
★ rational numbers in Lisp
★ Hash tables in various guises, in Lisp, Python, Lua
★ first class functions, closures, continuations in Functional programming languages such as Lisp and ML
One usually expects operations on primitive types to be the fastest language constructs there are. Integer addition, for example, can be performed as a single machine instruction, and some processors offer specific instructions to process sequences of characters with a single instruction. In particular, the C standard mentions that
"a
execution environment". This means that
int is likely to be 32 bits long on a 32-bitarchitecture.
Most languages do not allow the behaviour or capabilities of primitive types to be modified by programs. Exceptions include Smalltalk, which permits primitive datatypes to be extended within a program, adding to the operations that can be performed on them or even redefining the built-in operations.
This article provided by Wikipedia. To edit the contents of this article, click here for original source.
psst.. try this: add to faves

العربية
中国
Français
Deutsch
Ελληνική
हिन्दी
Italiano
日本語
Português
Русский
Español