티스토리 뷰

Computer Science

PL Ch 5. Data Type

words 2011. 5. 16. 14:38
모든 data type의 design issue
1. variable의 reference syntax는?
2. operation은?

Character String Types
 Implementation
  - Static Length
  - Limited dynamic length : run time descriptor 필요
  - Dynamic Length

Ordinal Types(user defined) : possible value의 range를 positive integer의 set과 쉽게 연관시킴
1. Enumeration type : 심볼릭 상수로 값 나열
2. Subrange Type : ordinal type의 순서있는 연속된 subsequence

Array : homogeneous data elements의 aggregate인데 각 element가 first element로부터의 상대적인 위치로 식별됨
-4개의 카테고리(subscript binding과 storage binding 기반)
 1. Static : subscript의 범위와 storage binding이 static.
 2. Fixed stack dynamic : subscript의 범위는 static하게 bound되지만 storage는 특정 시간에 bound됨.
 3. Stack-dynamic : range와 storage는 dynamic하지만 variable의 lifetime에 종속됨(fixed)
 4. Heap-dynamic : subscript range와 storage binding은 dynamic하고 fix되지 않음

Slice : array의 substructure
Associative Arrays : 같은 개수의 값인 key로 인덱스되는 data element의 unordered collection
Records : heterogeneous data의 aggregate인데 각 element가 name으로 식별됨
Unions : 실행 중에 다른 시점에 다른 type의 data를 저장할 수 있는 것
Set : 다른 값들의 unordered collection

Pointer : value의 range가 메모리 address와 특수한 값인 null로 이루어지는 타입.
포인터에서 발생할 수 있는 문제
 1. Dangling Pointer : deallocated된 heap-dynamic variable을 가리키고 있는 것
 2. Lost Heap-Dynamic Variable : 더이상 어느 pointer에게도 reference되지 않는 heap dynamic variable=>Memory leakage


   

'Computer Science' 카테고리의 다른 글

[Algorithms] Topological Sort  (0) 2011.05.30
[Compiler] JFlex & JCup 흐름  (0) 2011.05.28
PL Ch 4. Variable  (0) 2011.05.16
PL Ch 3. 정리  (0) 2011.05.16
[Algorithms] KMP 알고리즘  (0) 2011.04.30
댓글