UT Dallas CS 4337 - #Sebesta ch06 data type - short version cs4337 (84 pages)

Previewing pages 1, 2, 3, 4, 5, 6, 39, 40, 41, 42, 43, 79, 80, 81, 82, 83, 84 of 84 page document View the full content.
View Full Document

#Sebesta ch06 data type - short version cs4337



Previewing pages 1, 2, 3, 4, 5, 6, 39, 40, 41, 42, 43, 79, 80, 81, 82, 83, 84 of actual document.

View the full content.
View Full Document
View Full Document

#Sebesta ch06 data type - short version cs4337

24 views


Pages:
84
School:
University of Texas at Dallas
Course:
Cs 4337 - Organization of Programming Languages

Unformatted text preview:

Chapter 6 Data Types Chapter 6 Topics Introduction Primitive Data Types Character String Types User Defined Ordinal Types Array Types Associative Arrays Record Types Tuple Types List Types Union Types Pointer and Reference Types Type Checking Strong Typing Type Equivalence Theory and Data Types Copyright 2012 Addison Wesley All rights reserved 1 2 Introduction A Data type defines a collection of data objects and a set of predefined operations on those objects A Descriptor is the collection of the attributes of a variable An Object represents an instance of a userdefined abstract data type One design issue for all data types What operations are defined How are they specified Copyright 2012 Addison Wesley All rights reserved 1 3 Primitive Data Types Almost all programming languages provide a set of primitive data types Primitive data types Those not defined in terms of other data types Some primitive data types are merely reflections of the hardware Others require only a little non hardware support for their implementation Copyright 2012 Addison Wesley All rights reserved 1 4 Primitive Data Types Integer Almost always an exact reflection of the hardware so the mapping is trivial There may be as many as eight different integer types in a language Java s signed integer sizes byte short int long Copyright 2012 Addison Wesley All rights reserved 1 5 Primitive Data Types Floating Point Model real numbers but only as approximations Languages for scientific use support at least two floating point types e g float and double sometimes more Usually exactly like the hardware but not always IEEE Floating Point Standard 754 Copyright 2012 Addison Wesley All rights reserved 1 6 Primitive Data Types Complex Number Some languages support a complex type e g C99 Fortran and Python Each value consists of two floats the real part and the imaginary part Literal form in Python 7 3j where 7 is the real part and 3 is the imaginary part In Lisp C 7 3 Copyright 2012 Addison Wesley All rights reserved 1 7 Primitive Data Types Decimal For business applications money Essential to COBOL Using 4 bits as a nibble So 1 byte for 2 decimal digits C offers a decimal data type Store a fixed number of decimal digits in coded form BCD Using 1 byte for a digit where 4 bits for a decimal digit and 4 bits for sign Advantage accuracy Copyright 2012 Addison Wesley All rights reserved 1 8 Primitive Data Types Boolean Simplest of all Range of values two elements one for true and one for false Could be implemented as bits but often as bytes Advantage readability Copyright 2012 Addison Wesley All rights reserved 1 9 Primitive Data Types Character Stored as numeric coding Most commonly used coding ASCII An alternative 16 bit coding Unicode UCS2 Includes characters from most natural languages Originally used in Java C and JavaScript also support Unicode 32 bit Unicode UCS 4 Supported by Fortran starting with 2003 Copyright 2012 Addison Wesley All rights reserved 1



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view #Sebesta ch06 data type - short version cs4337 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view #Sebesta ch06 data type - short version cs4337 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?