본문 바로가기
프로그래밍/Study C

Program Structure

by Damon11 2022. 10. 19.

Principles of Componentization

sources

include files

coupling and cohesion

low coupling, high cohesive

 

 

Code Reuse

Standard library에 존재하는 기능의 함수는 새로 만들지 말고 가져다가 사용하자 -> 다른 사람들이 더 빨리 이해 가능

 

 

Data Abstractions

public interface

implementaion details

 

 

Opaque Types

external header files

remain private

 

 

Executables

컴파일러는 코드를 object 파일로 출력한다. link phase를 지나면 excutables로 출력됨

- a.out  , foo.exe

- a library

- a device driver , a firmware image

Linking 는 소스코드를 분리시켜 독립적으로 컴파일할 수 있게하고 재사용가능한 컴포넌트를 빌드할 수 있게 한다.

 

Library는 독립적으로 사용될 수 없는 excutable component이다. 라이브러리 기능을 사용하려면 헤더파일을 include 해야한다. but you do not directly compile the source code that implements the library functionality.

 

⨳ Static Library

incorperated at link time.

⨳ Dynamic Library

run time 에 memory로 load 됨

배포 후에 업데이트 가능

 

Linkage

C provides three kinds of linkage: external, internal, none.

static : explicit internal linkage

extern : explicit external linkage

 

Structuring a Simple Program

 

'프로그래밍 > Study C' 카테고리의 다른 글

Debugging, Testing and Analysis  (0) 2022.11.07
'Static' in C language  (0) 2022.10.27
PreProcessing  (0) 2022.10.17
Buffer  (0) 2022.10.11
I/O Stream  (0) 2022.10.11

댓글