Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 정수론
- php
- C
- C언어
- Algospot
- Cleancode
- 따배씨
- programmers
- dfs
- udemy
- DP
- greedy
- graph
- 인프런
- BASIC
- Algorithm
- Python
- 생활코딩
- 따라하면서 배우는 C언어
- String
- 백준
- 따라하며 배우는 C언어
- 종만북
- sorting
- BOJ
- BFS
- Math
- web
- JavaScript
- server
Archives
- Today
- Total
몽상실현개발주의
[따배씨] 16.11 inline 함수 본문
따배씨 - 따라하며 배우는 C언어
16강 전처리기와 라이브러리
16.11 inline 함수
- 작은 함수가 반복하여 사용 될 때, 실행 속도를 높일 수 있는 방법
#include <stdio.h>
/*
Function call has overhead
- set up the call, pass arguments, jump to the function code, end return.
inline function spectifier (함수 특성 지정자)
- suggets inline replacements. (제안을 함)
- function call overhead 가 없어짐
Inline functions should be short.
A function with internal linkage can be made inline.
You can't take its address. -> 함수의 내용을 복사 붙여넣기 처럼 동작하기 때문
*/
inline static int foo()
// internal linkage
{
return 5;
}
int main()
{
int ret;
// inline function call
ret = foo();
printf("Output is : %d\n", ret);
return 0;
}
* ```c
inline static int foo()
// internal linkage
{
return 5;
}
- gcc 나 clang 의 경우는 static 으로 선언하여 internal linkage 처리를 해주어야함
- 함수의 기본 선언은 external 이기 때문
- Compiler 가 자동으로 inline 으로 compile 하거나, function call 로 compile 하기도 함
- inline 은 주로 header 정의하여 사용
이 글의 모든 사진과 내용의 출처는 홍정모 교수님께 있음을 알려드립니다.
http://blog.naver.com/atelierjpro
실리콘 밸리의 프로그래머 : 네이버 블로그
안녕하세요! 홍정모 블로그에 오신 것을 환영합니다. 주로 프로그래밍 관련 메모 용도로 사용합니다. 강의 수강하시는 분들은 홍정모 연구소 카페로 오세요.
blog.naver.com
http://www.inflearn.com/course/following-c
홍정모의 따라하며 배우는 C언어 - 인프런 | 강의
'따배씨++'의 성원에 힘입어 새롭게 개발된 C 언어로 시작하는 프로그래밍 입문 강의입니다. '따배씨'와 함께 프로그래밍 인생을 업그레이드 해보세요., 따라하며 배우는 C언어 '따배씨++'의 성원
www.inflearn.com
'Language > C' 카테고리의 다른 글
[따배씨] 16.13 표준 수학 라이브러리 (0) | 2021.10.04 |
---|---|
[따배씨] 16.12 라이브러리 (0) | 2021.10.04 |
[따배씨] 16.10 _Generic 표현식 (0) | 2021.09.07 |
[따배씨] 16.9 #pragma 지시자 (0) | 2021.08.30 |
[따배씨] 16.8 미리 정의된 매크로들 #line, #error (0) | 2021.08.30 |
Comments