C++

๋žŒ๋‹ค ํ•จ์ˆ˜

January 02 2023

๋žŒ๋‹ค ํ•จ์ˆ˜ lambda ์ด๋ฆ„ ์—†๋Š”(์ต๋ช…์˜) ํ•จ์ˆ˜ ๊ฐ์ฒด

memcpy & memmove

August 07 2022

memcpy destination ์ฃผ์†Œ๊ฐ’, source ์ฃผ์†Œ๊ฐ’, source์˜ ๊ธธ์ด๋ฅผ ์ธ์ž๋กœ ๋ฐ›๋Š” ํ•จ์ˆ˜ sdource์˜ ๊ฐ’์„ destination์œผ๋กœ ๋ณต์‚ฌ

Initialization in Constructor

May 11 2022

Initialization ์–ด๋–ค ๊ฐ์ฒด๋“  ๊ฐ์ฒด์˜ ๋ฐ์ดํ„ฐ ๋ฉค๋ฒ„๋Š” ์ƒ์„ฑ์ž์˜ ๋ณธ๋ฌธ์ด ์‹คํ–‰๋˜๊ธฐ ์ „ ์ดˆ๊ธฐํ™”๋˜์–ด์•ผ ํ•œ๋‹ค

Return Value Optimization

April 06 2022

์ž„์‹œ ๊ฐ’ ํ• ๋‹น ์ธ์ž C++ ์—์„œ๋Š” ์ž„์‹œ๊ฐ’์„ const reference์™€ rvalue reference, ๊ทธ๋ฆฌ๊ณ  ๊ฐ’์œผ๋กœ์„œ์˜ ํ•จ์ˆ˜ ์ธ์ž๋กœ ๋ฐ›๋„๋ก ํ—ˆ์šฉํ•œ๋‹ค non-const reference ์ธ์ž๋ฅผ ๋ฐ›๋Š” ํ•จ์ˆ˜๋Š” ํ•จ์ˆ˜ ์‹คํ–‰ ์ค‘ ์ธ์ž๋ฅผ ์ˆ˜์ •ํ•˜๊ณ ์„œ ๋ณ€๊ฒฝ๋œ ์ƒํƒœ๋กœ ๋‹ค์‹œ caller๋กœ ๋Œ์•„๊ฐ€๋Š” ๊ฒƒ์„ ํ—ˆ์šฉํ•œ๋‹ค

Stack Overflow

March 01 2022

๋ฐœ์ƒ ์ด์œ  Stack ๋ฉ”๋ชจ๋ฆฌ์˜ ํฌ๊ธฐ๋Š” ์Šค๋ ˆ๋“œ๊ฐ€ ์ดˆ๊ธฐํ™”๋  ๋•Œ ๊ณ ์ •๋œ ํฌ๊ธฐ๋กœ ๊ฒฐ์ • ์‚ฌ์šฉ๋Ÿ‰์„ ์ดˆ๊ณผํ•˜์—ฌ ์‚ฌ์šฉํ•œ๋‹ค๋ฉด ์†Œํ”„ํŠธ์›จ์–ด๋Š” undefined behavior ์•ผ๊ธฐ Stack ์˜์—ญ์˜ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ์ง€์ •๋œ ๋ฒ”์œ„๋ฅผ ๋„˜์–ด๊ฐˆ ๋•Œ ๋ฐœ์ƒ ํ•œ ํ•จ์ˆ˜์—์„œ ๋„ˆ๋ฌด ํฐ ์ง€์—ญ ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธ ํ•จ์ˆ˜๋ฅผ ์žฌ๊ท€์ ์œผ๋กœ ๋ฌดํ•œ์ •...

Runtime Type Information

March 01 2022

RTTI๋ž€ C++ ์ปดํŒŒ์ผ๋Ÿฌ ๋‚ด์— ์žˆ๋Š” ๊ฐ์ฒด์˜ ํƒ€์ž… ์ •๋ณด๋ฅผ ์•Œ์•„๋‚ด๋Š” ๊ธฐ๋Šฅ ๋Ÿฐํƒ€์ž„์—์„œ ํฌ์ธํ„ฐ๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š” ๊ฐ์ฒด์˜ ํƒ€์ž…์„ ์•Œ ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๋ฐฉ๋ฒ• ๊ฐ์ฒด์˜ ํƒ€์ž…์„ ๋Ÿฐํƒ€์ž„์—์„œ ๊ฒฐ์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ—ˆ์šฉ ๋ฉ”๋ชจ๋ฆฌ ์ƒ์ฃผ ๊ฐ์ฒด์— ํƒ€์ž… ์ •๋ณด ์ถ”๊ฐ€ ๋Ÿฐํƒ€์ž„์—์„œ ๊ฐ์ฒด์˜ ์บ์ŠคํŒ…์ด ์œ ํšจํ•œ์ง€ ์•Œ์•„๋‚ด๊ธฐ ์œ„ํ•ด, ๊ฐ์ฒด๋ฅผ ํŠน์ • ํƒ€์ž…์œผ๋กœ ๊ฒฐ์ •ํ•œ...

Multiple Inheritance

November 16 2021

๋‹ค์ค‘ ์ƒ์† Multiple Inheritance C++์—์„œ๋Š” C#๊ณผ ๋‹ค๋ฅด๊ฒŒ, ๋‹ค์ค‘ ์ƒ์†์„ ํ—ˆ์šฉ ๊ธฐ๋ฐ˜ ํด๋ž˜์Šค์˜ ๋ฉค๋ฒ„ ๋˜๋Š” ๋ฉ”์„œ๋“œ์˜ ์ด๋ฆ„์ด ๋™์ผํ•œ ๊ฒฝ์šฐ ์ฃผ์˜ํ•ด์•ผ ํ•œ๋‹ค

DFS & BFS

November 14 2021

DFS Depth-Frist Search ํ˜„์žฌ ๋ถ„๊ธฐ๋ฅผ ์™„๋ฒฝํ•˜๊ฒŒ ํƒ์ƒ‰ํ•œ ๋’ค ๋‹ค์Œ ๋ถ„๊ธฐ๋กœ ์ด๋™ ํ˜„์žฌ ๋…ธ๋“œ์™€ ์ธ์ ‘ํ•œ ๋…ธ๋“œ๋ฅผ ์šฐ์„  ํƒ์ƒ‰ ๋” ์ด์ƒ ์ธ์ ‘ํ•œ ๋…ธ๋“œ๊ธฐ ์—†์„ ๋•Œ๊นŒ์ง€ ๋ฐ˜๋ณต ๊ทธ๋ž˜ํ”„ ๋‚ด์— cycle ์—ฌ๋ถ€๋ฅผ ํ™•์ธํ•  ๋•Œ ์‚ฌ์šฉ

Memory Allocator

November 13 2021

new/delete์™€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ด์œ ? ๊ธฐ๋Šฅ์˜ ๊ณผ๋„ํ•œ ๋ฒ”์šฉ์„ฑ ๋ฉ”๋ชจ๋ฆฌ ํ• ๋‹น ๋„ˆ๋จธ์˜ hidden behavior ์ˆ˜ํ–‰ ๋ถˆ์ถฉ๋ถ„ํ•œ ๊ธฐ๋Šฅ

Template vs. Generic

November 11 2021

C++ Template vs. C# Generic C++ ์€ ์ปดํŒŒ์ผ์ด 1๋ฒˆ ์ผ์–ด๋‚˜๊ณ , C# ์ œ๋„ค๋ฆญ์€ ์ปดํŒŒ์ผ์ด 2๋ฒˆ ์ผ์–ด๋‚œ๋‹ค. C++ ํ…œํ”Œ๋ฆฟ์€ ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋ฉด ์ปดํŒŒ์ผํ•˜์ง€ ์•Š๋Š”๋‹ค. ํ•˜์ง€๋งŒ, C# ์ œ๋„ค๋ฆญ์€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋”๋ผ๋„ ๊ทธ์— ๊ด€๋ จ๋œ ์ •๋ณด๋ฅผ ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ๋ฉ”ํƒ€๋ฐ์ดํ„ฐ๊ฐ€ ์ƒ์„ฑ๋œ๋‹ค. ์ œ๋„ค๋ฆญ์€ ๋น„ํ˜•์‹ ํƒฌํ”Œ๋ฆฟ ...

Heap & Priority Queue

October 29 2021

Heap ๊ตฌ์กฐ์ฒด ์šฐ์„ ์ˆœ์œ„ ํ๋ฅผ ์œ„ํ•ด ๋งŒ๋“ค์–ด์ง„ ์ž๋ฃŒ๊ตฌ์กฐ ์—ฌ๋Ÿฌ ๊ฐ’๋“ค ์ค‘ ์ตœ์†Ÿ๊ฐ’์ด๋‚˜ ์ตœ๋Œ“๊ฐ’์„ ๋น ๋ฅด๊ฒŒ ํƒ์ƒ‰ํ•˜๊ธฐ ์œ„ํ•œ ์ž๋ฃŒ๊ตฌ์กฐ ๋ฐ˜์ •๋ ฌ ์ƒํƒœ๋ฅผ ์œ ์ง€ ์ž‘์€ ๊ฐ’์€ ํ•˜์œ„, ํฐ ๊ฐ’์€ ์ƒ์œ„์— ์žˆ๋Š” ์ •๋„ ์ด์ง„ ํŠธ๋ฆฌ์™€๋Š” ๋‹ฌ๋ฆฌ, ์ค‘๋ณต๋œ ๊ฐ’์„ ํ—ˆ์šฉ ์ด์ง„ ํŠธ๋ฆฌ์—์„œ ํŠน์ •ํ•œ ์กฐ๊ฑด์„ ๊ฐ–์ถ˜ ๊ตฌ์กฐ์ฒด ํŠธ๋ฆฌ์˜ ๋†’์ด h๊ฐ€...

์Šค๋งˆํŠธ ํฌ์ธํ„ฐ - weak_ptr

October 24 2021

์„œ๋กœ ์ฐธ์กฐํ•˜๋Š” shared_ptr ์ˆœํ™˜ ์ฐธ์กฐํ•˜๋Š” shared_ptr์€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š”๋Œ€๋„ ์ž๋™์œผ๋กœ ๋ฉ”๋ชจ๋ฆฌ ํ•ด์ œ ๋ถˆ๊ฐ€

์Šค๋งˆํŠธ ํฌ์ธํ„ฐ - shared_ptr

October 24 2021

shared_ptr ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์Šค๋งˆํŠธ ํฌ์ธํ„ฐ๊ฐ€ ํ•˜๋‚˜์˜ ๊ฐ์ฒด๋ฅผ ๊ฐ™์ด ์†Œ์œ ํ•ด์•ผํ•˜๋Š” ์ƒํ™ฉ ํ•˜๋‚˜์˜ ์ž์›์„ ๋ช‡๊ฐœ์˜ ํฌ์ธํ„ฐ๊ฐ€ ๊ฐ€๋ฆฌํ‚ค๋Š”์ง€ ์ถ”์ ํ•˜๋Š” ํฌ์ธํ„ฐ control block์„ ํ• ๋‹นํ•˜์—ฌ ๋ณต์‚ฌ๋ฅผ ํ—ˆ์šฉ ๊ฐ shared_ptr ๊ฐ์ฒด์— ์ €์žฅ๋˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ์‹ค์ œ ๊ฐ์ฒด๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š” control block์„ ํ• ๋‹น ๊ฐ์ฒด๋ฅผ ๊ฐ€๋ฆฌํ‚ค๋Š”...

perfect forwarding

October 24 2021

์™„๋ฒฝํ•œ ์ „๋‹ฌ perfect forwarding wrapper ํ•จ์ˆ˜๊ฐ€ ํ•„์š”ํ•œ ๊ฒฝ์šฐ

exception

October 23 2021

์˜ˆ์™ธ๋ž€? ์ •์ƒ์ ์ธ ์ƒํ™ฉ์—์„œ ๋ฒ—์–ด๋‚œ ๋ชจ๋“  ์˜ˆ์™ธ์ ์ธ ์ƒํ™ฉ๋“ค

decltype ํ‚ค์›Œ๋“œ

October 22 2021

decltype ์‹๋ณ„์ž ํ‘œํ˜„์‹์ด ์•„๋‹Œ ์‹์„ ์ธ์ž๋กœ ๋ฐ›๊ณ , ๊ทธ ํƒ€์ž…์„ T๋ผ๊ณ  ํ–ˆ์„ ๋•Œ ์‹์˜ ๊ฐ’์ด xvalue์ธ ๊ฒฝ์šฐ -> T&& ๋ฅผ ๋ฆฌํ„ด ์‹์˜ ๊ฐ’์ด lvalue์ธ ๊ฒฝ์šฐ -> T& ๋ฅผ ๋ฆฌํ„ด ์‹์˜ ๊ฐ’์ด prvalue์ธ ๊ฒฝ์šฐ -> T ๋ฅผ ๋ฆฌํ„ด decltype...

map vs. unordered_map

August 20 2021

map ๋ ˆ๋“œ ๋ธ”๋ž™ ํŠธ๋ฆฌ ๊ธฐ๋ฐ˜ ๊ฒ€์ƒ‰์†๋„๊ฐ€ ๋น ๋ฅธ Binary Search Tree(BST) + Self-Balancing ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ O(logN)์„ ๋ณด์žฅํ•˜๋Š” ์ˆ˜์ค€์œผ๋กœ Balancing ํ‚ค ๊ฐ’์˜ ๋ถ„ํฌ๊ฐ€ ๊ณ ๋ฅด์ง€ ๋ชปํ•  ๊ฒฝ์šฐ node rotation์— ๋Œ€ํ•œ ๋น„์šฉ์ด ๊ณ„์† ๋ฐœ์ƒํ•˜๊ธฐ์— Insert / Delete ์„ฑ๋Šฅ์ด...

PP vs. OOP vs. DOP

August 11 2021

Procedural Programing (์ ˆ์ฐจ์  ํ”„๋กœ๊ทธ๋ž˜๋ฐ) ๋ฐ์ดํ„ฐ๋ฅผ ์ค‘์‹ฌ์œผ๋กœ ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด ์‚ฌ์šฉ ํ”„๋กœ๊ทธ๋žจ์ด ํ•จ์ˆ˜ํ™” ๋˜์–ด ์ˆœ์ฐจ์ ์œผ๋กœ ์ฒ˜๋ฆฌ ํ”„๋กœ๊ทธ๋žจ ์ „์ฒด๊ฐ€ ์œ ๊ธฐ์ ์œผ๋กœ ์—ฐ๊ฒฐ ์žฅ์  ์ปดํ“จํ„ฐ์˜ ์ฒ˜๋ฆฌ๊ตฌ์กฐ์™€ ์œ ์‚ฌํ•ด ์‹คํ–‰์†๋„๊ฐ€ ๋น ๋ฆ„ ๋‹จ์  ์œ ์ง€๋ณด์ˆ˜๊ฐ€ ์–ด๋ ค์›€ ์‹คํ–‰ ์ˆœ์„œ๊ฐ€ ์ •ํ•ด์ ธ ์žˆ์œผ๋ฏ€...

inline ํ‚ค์›Œ๋“œ

July 14 2021

ํ•จ์ˆ˜ ํ˜ธ์ถœ ๋น„์šฉ ํ•จ์ˆ˜ ํ˜ธ์ถœ๋  ๋•Œ๋งˆ๋‹ค ์ผ์ •๋Ÿ‰์˜ ์„ฑ๋Šฅ ์˜ค๋ฒ„ํ—ค๋“œ ๋ฐœ์ƒ CPU๊ฐ€ ๋‹ค๋ฅธ ๋ ˆ์ง€์Šคํ„ฐ์™€ ํ•จ๊ป˜ ์‹คํ–‰ ์ค‘์ธ ํ˜„์žฌ ๋ช…๋ น์–ด์˜ ์ฃผ์†Œ๋ฅผ ์ €์žฅํ•ด์•ผ ํž˜ ๋‚˜์ค‘์— ๋ฐ˜ํ™˜ํ•  ์œ„์น˜๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋„๋ก ๋ชจ๋“  ํ•จ์ˆ˜ ๋งค๊ฐœ ๋ณ€์ˆ˜๋ฅผ ์ƒ์„ฑ ์ƒˆ ์œ„์น˜๋กœ ๋ถ„๊ธฐํ•˜๊ธฐ ๋ณด๋‹ค ๋‚ด๋ถ€ ์ž‘์„ฑ ์ฝ”๋“œ(์ธ์Šคํ„ดํŠธ ์ฝ”๋“œ)๊ฐ€ ๋” ๋น ๋ฆ„

Callback

July 14 2021

Callback ํ•จ์ˆ˜ ๋‹ค๋ฅธ ํ”„๋กœ๊ทธ๋žจ ๋˜๋Š” ๋‹ค๋ฅธ ๋ชจ๋“ˆ์—์„œ ํ˜ธ์ถœ๋  ํ•จ์ˆ˜๋ฅผ ์•Œ๋ ค์ฃผ๊ณ , ๊ทธ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๋„๋ก ํ•˜๋Š” ๋ฐฉ๋ฒ• ์ผ๋ฐ˜์ ์œผ๋กœ OS๊ฐ€ ํ˜ธ์ถœํ•  ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ํ•จ์ˆ˜๋ฅผ ์ง€์ •ํ•ด ํŠน์ •ํ•œ ์‚ฌ๊ฑด / ๋ฉ”์„ธ์ง€๊ฐ€ ๋ฐœ์ƒํ•˜๋ฉด ํ˜ธ์ถœํ•˜๋„๋ก ์ง€์ • ์ผ๋ฐ˜ ํ•จ์ˆ˜ ํ˜ธ์ถœ ํด๋ผ์ด์–ธํŠธ์—์„œ ์„œ๋ฒ„์˜ ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ์‚ฌ์šฉ ์ฝœ๋ฐฑ ํ•จ์ˆ˜ ํ˜ธ์ถœ ...

friend ํ‚ค์›Œ๋“œ

February 05 2021

friend class ํ•œ class์—์„œ ๋‹ค๋ฅธ class์˜ field๋ฅผ public์œผ๋กœ ์ฐธ์กฐํ•˜๋„๋ก ํ—ˆ์šฉ

Template

November 03 2020

ํ…œํ”Œ๋ฆฟ(Template)์ด๋ž€ ํ•จ์ˆ˜๋‚˜ ํด๋ž˜์Šค๋ฅผ ๊ฐœ๋ณ„์ ์œผ๋กœ ๋‹ค์‹œ ์ž‘์„ฑํ•˜์ง€ ์•Š์•„๋„, ์—ฌ๋Ÿฌ ์ž๋ฃŒ ํ˜•์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๊ฒŒ ๋งŒ๋“ค์–ด ๋†“์€ ํ‹€ ํ•จ์ˆ˜ ํ…œํ”Œ๋ฆฟ(Function Template)์™€ ํด๋ž˜์Šค ํ…œํ”Œ๋ฆฟ(Class Template)์œผ๋กœ ๋ถ„๋ฅ˜

STL - Vector, List, Queue

November 03 2020

์ปจํ…Œ์ด๋„ˆ์˜ ์ข…๋ฅ˜ Sequence Container ๊ฐ์ฒด๋ฅผ ์ˆœ์‚ฌ์ ์œผ๋กœ ๋ณด๊ด€ ex) vector, list, queue, โ€ฆ Associative Container ํ‚ค๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ๋Œ€์‘๋˜๋Š” ๊ฐ’ ํ•จ๊ป˜ ๋ณด๊ด€ ํ‚ค๋กœ ํƒ์ƒ‰ํ•˜์—ฌ ๊ฐ’์„ ๋ฐ˜ํ™˜ ex) map, set, unord...

STL - Map, Set

November 03 2020

Binary Search ์ด๋ฏธ ์ •๋ ฌ๋˜์–ด ์žˆ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ๋Œ€์ƒ์œผ๋กœ ํƒ์ƒ‰ ์ค‘๊ฐ„ ๊ฐ’์ธ pivot์„ ๊ธฐ์ค€์œผ๋กœ left์™€ right์œผ๋กœ ๋‚˜๋ˆ„์–ด ํƒ์ƒ‰ ๊ฐ’์„ ์ฐพ์„ ๋•Œ๊นŒ์ง€ ์œ„์˜ ๊ณผ์ •์„ ๋ฐ˜๋ณต

Overriding & Overloading

November 02 2020

Overloading ๊ฐ™์€ ์ด๋ฆ„์˜ ๋ฉ”์„œ๋“œ๋ฅผ ์—ฌ๋Ÿฌ ๊ฐœ ์ •์˜ ๋งค๊ฐœ๋ณ€์ˆ˜์˜ ํƒ€์ž…์ด ๋‹ค๋ฅด๊ฑฐ๋‚˜, ๊ฐฏ์ˆ˜๊ฐ€ ๋‹ค๋ฆ„ ๋ฆฌํ„ด ํƒ€์ž…์ด๋‚˜ ์ ‘๊ทผ ์ œ์–ด์ž๋Š” ์˜ํ–ฅ์„ ์ฃผ์ง€ ์•Š์Œ

if & switch

July 16 2020

if ๊ฐ€์žฅ ์œ„ if ๊ตฌ๋ฌธ๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ด ์กฐ๊ฑด์ด ์ถฉ์กฑ๋˜๋Š”์ง€ ์ปจ๋””์…˜ ์ฒดํฌ ๋Š๋ฆฐ ์†๋„ if, else if ๊ฐ€ ๋งŽ์•„์งˆ์ˆ˜๋ก Assembly: CMP๋„ ๋งŽ์•„์ง ๋ฒ”์œ„ ์‹๋„ ์ฒดํฌ ๊ฐ€๋Šฅ

enum๊ณผ enum class

July 16 2020

enum๊ณผ enum class์˜ ์ฐจ์ด ๊ฐ’ ์ค‘๋ณต ์—๋Ÿฌ ์—ฌ๋ถ€

Shallow & Deep Copy

July 16 2020

Shallow Copy ๊ฐ์ฒด๋ฅผ ๋ณต์‚ฌํ•  ๋•Œ ์›๋ž˜๊ฐ’๊ณผ ๋ณต์‚ฌ๋œ ๊ฐ’์ด ๊ฐ™์€ ์ฐธ์กฐ๋ฅผ ๊ฐ€๋ฆฌํ‚ค๊ณ  ์žˆ๋Š” ๊ฒƒ ๊ฐ์ฒด์˜ โ€˜๊ฐ’โ€™๋งŒ ๋ณต์‚ฌ

lvalue์™€ rvalue

July 15 2020

Value Category ์ •์ฒด๋ฅผ ์•Œ ์ˆ˜ ์žˆ๋Š”๊ฐ€ ํ•ด๋‹น ์‹์ด ๋‹ค๋ฅธ ์‹๊ณผ ๊ฐ™์€ ๊ฒƒ์ธ์ง€ ์•„๋‹Œ์ง€ ๊ตฌ๋ถ„ํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€? ๋ณ€์ˆ˜ - ์ฃผ์†Œ๊ฐ’์„ ํ†ตํ•ด ๊ตฌ๋ถ„ ํ•จ์ˆ˜ - ์ด๋ฆ„์œผ๋กœ ๊ตฌ๋ถ„ ์ด๋™ ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š”๊ฐ€ ํ•ด๋‹น ์‹์„ ์•ˆ์ „ํ•˜๊ฒŒ ๋‹ค๋ฅธ ๊ณณ์œผ๋กœ ์ด๋™ํ•  ์ˆ˜ ์žˆ๋Š”๊ฐ€? ์ด๋™ ์ƒ์„ฑ์ž, ์ด๋™ ๋Œ€์ž…...

const & volatile ํ‚ค์›Œ๋“œ

July 15 2020

Read-Only ๋ณ€์ˆ˜์˜ ๊ฐ’์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†๋‹ค ๋ฉ”์„œ๋“œ์—์„œ ํด๋ž˜์Šค์˜ ๋ฉค๋ฒ„ ๋ณ€์ˆ˜๋ฅผ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์—†๋‹ค

static ํ‚ค์›Œ๋“œ

July 14 2020

ํ•จ์ˆ˜์˜ static ๋ณ€์ˆ˜ ํ•จ์ˆ˜ ์•ˆ์—์„œ ์„ ์–ธ๋œ static ๋ณ€์ˆ˜ ๊ฐ’์ด ๊ณ ์ •๋จ multi-thread hardware interrupt timer

C์™€ C++ ์ฐจ์ด ๋ช‡ ๊ฐ€์ง€

July 14 2020

C์˜ malloc๊ณผ C++ new์˜ ์ฐจ์ด malloc malloc์€ ํ•จ์ˆ˜(function) ํ• ๋‹นํ•  ๋ฉ”๋ชจ๋ฆฌ์˜ ์‚ฌ์ด์ฆˆ๋ฅผ ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ ๋ฐ›์Œsize as input header file์„ ํฌํ•จ์‹œ์ผœ์•ผ ํ•จ ์‹ค ์‚ฌ์šฉํ•  ํƒ€์ž…์œผ๋กœ casting ํ•„์š” ๋ฉ”๋ชจ๋ฆฌ ์ฒญํฌ๋งŒ heap์—์„œ ๋ฐ›...

Memory Layout

July 14 2020

C/C++ ๋ฉ”๋ชจ๋ฆฌ ๋ ˆ์ด์•„์›ƒ Text segment ๊ธฐ๊ณ„์–ด๋กœ ๋ณ€ํ™˜๋œ ์‹คํ–‰์ฝ”๋“œ๊ฐ€ ๋ฉ”๋ชจ๋ฆฌ or obj์— ์ €์žฅ

Casting

July 14 2020

static_cast ๋…ผ๋ฆฌ ํ˜•๋ณ€ํ™˜ ์ฃผ๋กœ Scalar Type๋“ค ๊ฐ„์˜ ์บ์ŠคํŒ… ํ˜• ๋ณ€ํ™˜ ํ•จ์ˆ˜๊ฐ€ ์ •์˜๋˜์–ด ์žˆ์œผ๋ฉด ์ด ํ•จ์ˆ˜๋ฅผ ํ˜ธ์ถœํ•˜๋ฉด์„œ ์‹คํ–‰ ์—ฐ์‚ฐ์ž ์˜ค๋ฒ„๋กœ๋”ฉ์„ ํ†ตํ•˜์—ฌ ๋ณ€ํ™˜ ๊ฐ€๋Šฅํ•œ ์ž๋ฃŒํ˜•์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋‹ค ์ปดํŒŒ์ผ ํƒ€์ž„์—์„œ ์บ์ŠคํŒ