c++ ์ฝ๋ฉ ์ปจ๋ฒค์
https://github.com/microsoft/AirSim/blob/master/docs/coding_guidelines.md
ํ๊ฐ๋ฆฌ์ ํ๊ธฐ๋ฒ์ ์ฌ์ฉํ๋ ค๊ณ ํ๋๋ฐ, ๊ตฌ์์ด๊ณ ๋จ์ ์ด ๋ง์์ ๊ฑฐ์ ์์ด๋ค๊ณ ํ๋ค. ms์ airsim์์ ์ฐ๊ณ ์๋ Modern C++ Coding Guideline์ ์ฐธ๊ณ ํ๋ค.
๋ค์ด๋ฐ ๊ท์น
Avoid using any sort of Hungarian notation on names and โ_ptrโ on pointers.
Code Element | Style | Comment |
---|---|---|
Namespace | under_scored | Differentiate from class names |
Class name | CamelCase | To differentiate from STL types which ISO recommends (do not use โCโ or โTโ prefixes) |
Function name | camelCase | Lower case start is almost universal except for .Net world |
Parameters/Locals | under_scored | Vast majority of standards recommends this because _ is more readable to C++ crowd (although not much to Java/.Net crowd) |
Member variables | under_scored_with_ | The prefix _ is heavily discouraged as ISO has rules around reserving _identifiers, so we recommend suffix instead |
Enums and its members | CamelCase | Most except very old standards agree with this one |
Globals | g_under_scored | You shouldnโt have these in first place! |
Constants | UPPER_CASE | Very contentious and we just have to pick one here, unless if is a private constant in class or method, then use naming for Members or Locals |
File names | Match case of class name in file | Lot of pro and cons either way but this removes inconsistency in auto generated code (important for ROS) |
0.๊ณผ์ ์กฐ๊ฑด ์ ๋ฆฌ
- C++98๋ฒ์ ๋ง ์ฌ์ฉํ ๊ฒ.
- ํค๋๋ ๋ณดํธ()๋์ด์ผํ๋ฉฐ ๊ตฌํ๋ถ๊ฐ ์์ผ๋ฉด ์๋๋ค.
- ๋ชจ๋ ์ถ๋ ฅ์ ํ์ค์ถ๋ ฅ์ด์ฌ์ผํ๋ฉฐ, ๋ช ์๋์ง ์์ ๊ฒฝ์ฐ ๊ฐํ์ผ๋ก ๋๋๋ค.
- ํ์ผ๋ช , ํด๋์ค๋ช , ํจ์๋ช , ๊ทธ๋ฆฌ๊ณ ๋ฉ์๋๋ช ๋ค์ ๋ฌธ์(letter)๋ค์์ ์์ผํ๋ค ?
- malloc์๋ฆฌ์ฆ, printf์๋ฆฌ์ฆ, free๋ ๊ธ์ง๋๋ค.
- ์์ง์
ํค๋์ ์ด๋ ํ ์์๋ ์ฌ์ฉ ๋ถ๊ฐํ๋ค. - namespace, friendํค์๋๋ ๊ธ์ง๋๋ค.
- ํด๋์ค๋ช .cpp, ํด๋์ค๋ช .hppํํ๋ก ๋ค์ด๋ฐ๋์ด์ผํ๋ค.
- ๊ณผ์ ๋ด๋ถ์ ๋๋ ํ ๋ฆฌ๋ช ์ ex00/, ex01/, โฆํํ๋ก ๋ค์ด๋ฐ ๋์ด์ผํ๋ค.
- c++๋ก ์ปดํ์ผํ๋ฉฐ, -Wall -Wextra -Werror์ต์ ์ ์ ์ฉ์ํจ๋ค.
EX00 : Megaphone
c++์คํ์ผ๋ก ์ ๋ ฅ๋ฐ์ ๋ฌธ์์ด์ ๋๋ฌธ์๋ก ๋ฐ๊ฟ์ ์ถ๋ ฅํ๋ ํ๋ก๊ทธ๋จ. ๋ฌธ์์ด ์ฌ์ด๋ ๊ณต๋ฐฑ์ผ๋ก ๊ตฌ๋ถ๋๊ณ , ๋ฌธ์์ด ์๋ค์ ํ์ดํธ์คํ์ด์ค๋ trim๋๋ค.
EX01 : My Awesome
์ ํ๋ฒํธ๋ถ์ฒ๋ผ ๋์ํ๋ ํ๋ก๊ทธ๋จ์ ์์ฑํ๋ผ. ์ด๋ ํ ๋์ ํ ๋น๋ ํ์ง์์ผ๋ฉฐ, 8๊ฐ ์ด์์ ์ฝํ ์ธ ๊ฐ ์ ๋ ฅ๋๋ ๊ฒฝ์ฐ ๊ฐ์ฅ ์ค๋๋๊ฒ์ ๋ฎ์ด์์ด๋ค.
contact์ ํ๋ : first name, last name, nickname, phone number(array),darkest secret.
PhoneBook์ ์ฝ๋์์ ์ธ์คํด์คํํ๋ก ์ ์๋๋ค.
์ฐ๋ฝ์ฒ๋ ํด๋์ค ๋ด๋ถ์ ์ธ์คํด์ค ํํ๋ก ์ ์๋๋ค.
- EXIT : ํ๋ก๊ทธ๋จ์ ์ข ๋ฃํ๊ณ , ์ ์ฅํ ๋ฐ์ดํฐ๋ฅผ ์ ๋ถ ์๋๋ค(RAM).
- ADD : ํ๋ก๊ทธ๋จ์ ํ ํ๋์ฉ, ๋ชจ๋ ํ๋๊ฐ ์ฑ์์ง๋๊น์ง ์๋ก์ด ์ฐ๋ฝ์ฒ์ ์ ๋ณด๋ฅผ promptํ๋ค.
- SEARCH : ๋น์ด์์ง ์์ ์ฐ๋ฝ์ฒ๋ฅผ 4์ด์ ์ถ๋ ฅํ๋ค(index, first name, last name and nickname). ์ถ๋ ฅ๋๋ ๋ชจ๋ ์ด์ 10์ ๊ฐ๊ฒฉ์ ๊ฐ์ง๋ฉฐ ์ค๋ฅธ์ชฝ์ |์ ์ํด ๊ตฌ๋ถ๋๋ค. 10๋ฒ์งธ ๋ฌธ์ ์ดํ์ ๋ด์ฉ์ ์ถ๋ ฅ๋ ๋ โ.โ๋ก ์นํ๋๋ค. ์ํ๋ ์ธ๋ฑ์คํญ๋ชฉ์ ์ ๋ ฅ๋ฐ์ผ๋ฉด ๊ทธ ์ฐ๋ฝ์ฒ๋ฅผ ํ ํ๋๋น ํ ์ค์ฉ ์ถ๋ ฅํ๋ค. ์๋ฏธ์๋ ์ ๋ ฅ์์ ์์ธ์ฒ๋ฆฌ๋ฅผ ํด์ผํ๋ค.
- ๊ทธ ์ธ์ ์ ๋ ฅ์ ๋ฒ๋ ค์ง๋ค.
- EXIT๋ ๋๊น์ง ํ๋ก๊ทธ๋จ์ ๋ฐ๋ณต๋๋ค.
์ค๊ณ ๋ฐฉ์ : Phone book๊ณผ ๊ทธ ๋ด๋ถ์ 8๊ฐ์ page๋ก ๊ตฌ๋ถ.
- page : Phone book์ผ๋ก ๋ถํฐ ์ ๋ ฅ๋๋ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๊ณ ์ถ๋ ฅํ๋ ํด๋์ค.
- Phone book : 8๊ฐ์ pageํด๋์ค๋ฅผ ๊ฐ์ง๊ณ ์๊ณ , ๋ช ๋ น์ด ์ ๋ ฅ์ ๋ง๋ page ๋ฉค๋ฒํจ์๋ฅผ ์ถ๋ ฅํ๋ ํด๋์ค.
https://www.cplusplus.com/reference/
EX02 : The Job Of Your Dreams
hppํ์ผ์ด๋ test(mainํจ์) ๊ทธ๋ฆฌ๊ณ log๋ฅผ ์ฐธ๊ณ ํ์ฌ, ์ปดํ์ผ์ ํ์ํ Account์ ๋งด๋ฒํจ์๋ค์ ์ค๊ณํ๋ ๊ณผ์ .
hppํ์ผ๋ค์ ๋ณด๋ฉด staticํจ์๋ค๊ณผ ๋ณ์๋ค๊ณ ๊ตฌ์ฑ๋์ด ์๋ค.
์ ์ ๋ฉค๋ฒ(๋ณ์์ ํจ์)
static์ ์ ๋งด๋ฒ ๋ณ์ : .
- static ๋ฉค๋ฒ ๋ณ์ :
- class์ ๋ชจ๋ ์ธ์คํด์ค๊ฐ ์ฐธ๊ณ ํ๋ ๋ณ์.
- class์ ์ธ์คํด์คํ ์์ด ์ ๊ทผ ๊ฐ๋ฅ. -> this์ฌ์ฉ ๋ถ๊ฐ.
- ๋ฉ๋ชจ๋ฆฌ์ code์์ญ์ ์ฌ๋ผ๊ฐ.
- static ๋ฉค๋ฒ ํจ์ :
- class์ ์ธ์คํด์คํ ์์ด ์ ๊ทผ ๊ฐ๋ฅ. -> this์ฌ์ฉ ๋ถ๊ฐ.
- static ๋ฉค๋ฒ ํจ์๋ non-static ๋งด๋ฒ๋ฅผ ์ฌ์ฉํ ์ ์๋ค. -> ๋ฐํ์ ๋ฉ๋ชจ๋ฆฌ ์์ฑ ์์.
- non-static์ฒ๋ผ ๋ฉ๋ชจ๋ฆฌ์ code์์ญ์ ์ฌ๋ผ๊ฐ.
์ ์ธ๊ณผ ์ ์(feat. ์ ์ ๋ฉค๋ฒ)
- ์ ์ธ(declaration) : ํค๋ ๋ด๋ถ์์ ์ปดํ์ผ๋ฌ์๊ฒ ์ ๋ณด๋ง์ ์ฃผ๋ฉฐ, ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ง ์๋ ๊ฒ.
- ์ ์(definition) : ์ค์ ๋ฉ๋ชจ๋ฆฌ์ ํ ๋น ๋๋ ๊ฒ. ๋ณ์๋ ํจ์๋ค์ ์ด๊ธฐํ, ์์ฑ, ์ฝ๋์์ฑ์ด ํด๋น๋๋ค.
์ ์ ๋ฉค๋ฒ ๋ณ์์ ๊ฒฝ์ฐ ํด๋์ค ๋ฐ(์ ์ญ??)์์ ์ด๋ฅผ ์ ์(์ด๊ธฐํ)ํด์ผํ๋ค. ์์ฑ์์์ ์ฐ์ฐ์ ๊ฐ๋ฅํ์ง๋ง ์ ์ ๋ฐ ์ด๊ธฐํ๋ ๋ถ๊ฐํ๋ค. -> main๋ด๋ถ์์ ๋ถ๊ฐ๋ฅํ๋ค๋๋ฐ? ๋ฒ์ ๋ง๋ค ๋ค๋ฅด๋???
- ์ฃผ์1. static const ๋งด๋ฒ ๋ณ์๋ ํด๋์ค ๋ด๋ถ์์ ์ด๊ธฐํ ๊ฐ๋ฅํ๋ค. -> const๊ฐ์ ์ปดํ์ผ ํ์์ ๊ฒฐ์ ๋๊ณ , ๋ณ๊ฒฝ์ด ๋ถ๊ฐ๋ฅํ๊ธฐ ๋๋ฌธ.
- ์ฃผ์2. privateํ static ๋งด๋ฒ ๋ณ์๋ ํด๋์ค ์ธ๋ถ์์ ์ ๊ทผ ๊ฐ๋ฅํ๋ค. -> const๊ฐ์ ์ปดํ์ผ ํ์์ ๊ฒฐ์ ๋๊ณ , ๋ณ๊ฒฝ์ด ๋ถ๊ฐ๋ฅํ๊ธฐ ๋๋ฌธ.
์ฐธ๊ณ : https://ansohxxn.github.io/cpp/chapter8-10/, https://woo-dev.tistory.com/67
test.cpp
ํด์.
test.cpp
์์ accounts_t
๋ typedef std::vector<Account::t> = typedef std::vector<Account>
์ ๊ฐ๋ค.
mem_fun_ref
ํ
ํ๋ฆฟ:
Function for_each(InputIterator first, InputIterator last, Function fn);
for_each
์ฌ์ฉ์, ๊ฐ ์ํ์๋ฅผ first๋ถํฐ last๊น์ง ๋์
ํ๋ฉด์ fn์ ์คํํ ์ ์๋ค.
fn์ ๊ฒฝ์ฐ ํจ์๊ฐ ์ ๋ฌ๋๋๋ฐ,
- fn์ด ์ผ๋ฐํจ์์ธ ๊ฒฝ์ฐ fn๊ทธ๋๋ก ์ ๋ฌ
- fn์ด Account ํด๋์ค ์ธ์คํด์ค์ ํฌ์ธํฐ์ ๋งด๋ฒ(โฆ;)ํจ์์ธ ๊ฒฝ์ฐ mem_fun(&account::fn)ํํ๋ก ์ ๋ฌ
- fn์ด Account ํด๋์ค ์ธ์คํด์ค์ด๊ฑฐ๋ ์ธ์คํด์ค์ ์ฐธ์กฐ์ ๋งด๋ฒํจ์์ธ ๊ฒฝ์ฐ mem_fun_ref(account::fn)ํํ๋ก ์ ๋ฌ
์ฐธ๊ณ : (ifyouwanna ํฐ์คํ ๋ฆฌ)[https://ifyouwanna.tistory.com/entry/memfun-%EC%99%80-memfunref-%EB%A5%BC-%EC%9D%B4%EC%9A%A9%ED%95%9C-%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98%EC%97%90-%EB%A9%A4%EB%B2%84%ED%95%A8%EC%88%98-%EC%A0%84%EB%8B%AC]
์ปดํ์ผ์ ์๋ฌ
Undefined symbols for architecture x86_64:
"Account::makeDeposit(int)", referenced from:
_main in tests-6deae4.o
"Account::makeWithdrawal(int)", referenced from:
_main in tests-6deae4.o
"Account::displayAccountsInfos()", referenced from:
_main in tests-6deae4.o
"Account::Account(int)", referenced from:
void std::__1::allocator<Account>::construct<int>(Account*, int const&) in tests-6deae4.o
"Account::~Account()", referenced from:
std::__1::allocator<Account>::destroy(Account*) in tests-6deae4.o
"Account::displayStatus() const", referenced from:
_main in tests-6deae4.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
log ๋ถ์
>> ์์ฑ์
[19920104_091532] index:0;amount:42;created
[19920104_091532] index:1;amount:54;created
[19920104_091532] index:2;amount:957;created
[19920104_091532] index:3;amount:432;created
[19920104_091532] index:4;amount:1234;created
[19920104_091532] index:5;amount:0;created
[19920104_091532] index:6;amount:754;created
[19920104_091532] index:7;amount:16576;created
>> Account::displayAccountsInfos();
[19920104_091532] accounts:8;total:20049;deposits:0;withdrawals:0
>> std::for_each( acc_begin, acc_end, std::mem_fun_ref( &Account::displayStatus ) );
[19920104_091532] index:0;amount:42;deposits:0;withdrawals:0
[19920104_091532] index:1;amount:54;deposits:0;withdrawals:0
[19920104_091532] index:2;amount:957;deposits:0;withdrawals:0
[19920104_091532] index:3;amount:432;deposits:0;withdrawals:0
[19920104_091532] index:4;amount:1234;deposits:0;withdrawals:0
[19920104_091532] index:5;amount:0;deposits:0;withdrawals:0
[19920104_091532] index:6;amount:754;deposits:0;withdrawals:0
[19920104_091532] index:7;amount:16576;deposits:0;withdrawals:0
>> for ( acc_int_t it( acc_begin, dep_begin );
it.first != acc_end && it.second != dep_end;
++(it.first), ++(it.second) ) {
(*(it.first)).makeDeposit( *(it.second) );
}
[19920104_091532] index:0;p_amount:42;deposit:5;amount:47;nb_deposits:1
[19920104_091532] index:1;p_amount:54;deposit:765;amount:819;nb_deposits:1
[19920104_091532] index:2;p_amount:957;deposit:564;amount:1521;nb_deposits:1
[19920104_091532] index:3;p_amount:432;deposit:2;amount:434;nb_deposits:1
[19920104_091532] index:4;p_amount:1234;deposit:87;amount:1321;nb_deposits:1
[19920104_091532] index:5;p_amount:0;deposit:23;amount:23;nb_deposits:1
[19920104_091532] index:6;p_amount:754;deposit:9;amount:763;nb_deposits:1
[19920104_091532] index:7;p_amount:16576;deposit:20;amount:16596;nb_deposits:1
>> Account::displayAccountsInfos();
[19920104_091532] accounts:8;total:21524;deposits:8;withdrawals:0
>> std::for_each( acc_begin, acc_end, std::mem_fun_ref( &Account::displayStatus ) );
[19920104_091532] index:0;amount:47;deposits:1;withdrawals:0
[19920104_091532] index:1;amount:819;deposits:1;withdrawals:0
[19920104_091532] index:2;amount:1521;deposits:1;withdrawals:0
[19920104_091532] index:3;amount:434;deposits:1;withdrawals:0
[19920104_091532] index:4;amount:1321;deposits:1;withdrawals:0
[19920104_091532] index:5;amount:23;deposits:1;withdrawals:0
[19920104_091532] index:6;amount:763;deposits:1;withdrawals:0
[19920104_091532] index:7;amount:16596;deposits:1;withdrawals:0
>> for ( acc_int_t it( acc_begin, wit_begin );
it.first != acc_end && it.second != wit_end;
++(it.first), ++(it.second) ) {
(*(it.first)).makeWithdrawal( *(it.second) );
}
[19920104_091532] index:0;p_amount:47;withdrawal:refused
[19920104_091532] index:1;p_amount:819;withdrawal:34;amount:785;nb_withdrawals:1
[19920104_091532] index:2;p_amount:1521;withdrawal:657;amount:864;nb_withdrawals:1
[19920104_091532] index:3;p_amount:434;withdrawal:4;amount:430;nb_withdrawals:1
[19920104_091532] index:4;p_amount:1321;withdrawal:76;amount:1245;nb_withdrawals:1
[19920104_091532] index:5;p_amount:23;withdrawal:refused
[19920104_091532] index:6;p_amount:763;withdrawal:657;amount:106;nb_withdrawals:1
[19920104_091532] index:7;p_amount:16596;withdrawal:7654;amount:8942;nb_withdrawals:1
>> Account::displayAccountsInfos();
[19920104_091532] accounts:8;total:12442;deposits:8;withdrawals:6
std::for_each( acc_begin, acc_end, std::mem_fun_ref( &Account::displayStatus ) );
[19920104_091532] index:0;amount:47;deposits:1;withdrawals:0
[19920104_091532] index:1;amount:785;deposits:1;withdrawals:1
[19920104_091532] index:2;amount:864;deposits:1;withdrawals:1
[19920104_091532] index:3;amount:430;deposits:1;withdrawals:1
[19920104_091532] index:4;amount:1245;deposits:1;withdrawals:1
[19920104_091532] index:5;amount:23;deposits:1;withdrawals:0
[19920104_091532] index:6;amount:106;deposits:1;withdrawals:1
[19920104_091532] index:7;amount:8942;deposits:1;withdrawals:1
>> ์๋ฉธ์
[19920104_091532] index:0;amount:47;closed
[19920104_091532] index:1;amount:785;closed
[19920104_091532] index:2;amount:864;closed
[19920104_091532] index:3;amount:430;closed
[19920104_091532] index:4;amount:1245;closed
[19920104_091532] index:5;amount:23;closed
[19920104_091532] index:6;amount:106;closed
[19920104_091532] index:7;amount:8942;closed
Account::Account(int) = Account( int initial_deposit );
accounts_t accounts( amounts, amounts + amounts_size );
test.cpp 24 accounts_t accounts( amounts, amounts + amounts_size ); ์์ฑ์ ํธ์ถ์ [19920104_091532] index:0;amount:42;created ์ถ๋ ฅ.
- [19920104_091532] : _displayTimestamp()
- index:n : _accountIndex = getNbAccounts(), _accountIndex์ถ๋ ฅ
- amount:42 : _amount์ ์ ์ฅ. _amount์ถ๋ ฅ, _totalAmount๊ฐฑ์ .
- created : ๊ฑ ์ถ๋ ฅ.
- non-static๋งด๋ฒ ๋ณ์ ์ด๊ธฐํ.
Account::displayAccountsInfos() = static void displayAccountsInfos( void );
Account::displayAccountsInfos();
[19920104_091532] accounts:8;total:20049;deposits:0;withdrawals:0
- [19920104_091532] : _displayTimestamp()
- accounts:8 : getNbAccounts()
- total:20049 : getTotalAmount()
- deposits:0 : getNbDeposits()
- withdrawals:0 : getNbWithdrawals()
Account::makeDeposit(int) = void makeDeposit( int deposit );
for ( acc_int_t it( acc_begin, dep_begin );
it.first != acc_end && it.second != dep_end;
++(it.first), ++(it.second) ) {
(*(it.first)).makeDeposit( *(it.second) );
}
[19920104_091532] index:0;p_amount:42;deposit:5;amount:47;nb_deposits:1
- [19920104_091532] : _displayTimestamp()
- index:0 : _accountIndex์ ๊ทผ.
- p_amount:47 : _amount์ ๊ทผ.
- deposit:5 : deposit
- amount:47 : _amount += deposit, _nbDeposits++, _totalNbDeposits++ ๋ฐ _totalAmount๊ฐฑ์
- nb_deposits:1 : _nbDeposits์ ๊ทผ.
Account::makeWithdrawal(int) = bool makeWithdrawal( int withdrawal );
for ( acc_int_t it( acc_begin, wit_begin );
it.first != acc_end && it.second != wit_end;
++(it.first), ++(it.second) ) {
(*(it.first)).makeWithdrawal( *(it.second) );
}
[19920104_091532] index:0;p_amount:47;withdrawal:refused
[19920104_091532] index:1;p_amount:819;withdrawal:34;amount:785;nb_withdrawals:1
- [19920104_091532] : _displayTimestamp()
- index:0 : _accountIndex์ ๊ทผ.
- p_amount:47 : _amount์ ๊ทผ.
- withdrawal:refused / withdrawal:34 : if _amount > withdrawalโฆ, _nbWithdrawals++, _totalNbWithdrawals++ ๋ฐ _totalAmount๊ฐฑ์
- nb_withdrawals:1 : _nbWithdrawals์ ๊ทผ.
Account::~Account() = ~Account( void );
return 0;
Account::displayStatus() const = void displayStatus( void ) const;
[19920104_091532] index:0;amount:47;closed
- [19920104_091532] : _displayTimestamp()
- index:n : _accountIndex = getNbAccounts(), _accountIndex์ถ๋ ฅ
- amount:47 : _amount์ถ๋ ฅ.
- closed : ๊ฑ ์ถ๋ ฅ.
- ํด๋์ค์ static ๋งด๋ฒ ๋ณ์๋ค ๊ฐ์ ์๋ฉธ๋ ๊ฐ์ฒด์ ์ ๋ณด ๋ฐ์(๋นผ์ค).
๊ตฌํํ๋ฉด์ ์ถ๊ฐ.
- ๊ตฌํํ์ผ(
.cpp
)์์ ์ ์ ๋ฉค๋ฒ๋ฅผ ์ ์ํ ๋static
ํค์๋๋ฅผ ์ฐ์ง ์๋๋ค(link error : a storage class may not be specified here). -> - ์ ์ ๋ฉค๋ฒ ๋ณ์๋ฅผ ํด๋์ค ๊ตฌํํ์ผ(
.cpp
)์์ ์ ์ํ ๋int Accout::_nbAccounts = 0;
ํํ๋ก ์ ์ญ์ผ๋ก ์ ์ํ๋ค. std::cout.width(n)
,std::cout.fill('?')
์ ๊ฒฝ์ฐ,std::cout
์<<
๋ก ๋๋์ด์ ๋ค์ด์จ ๋จ์๋ณ๋ก ์ ์ฉ๋จ.- const์์น : https://easycoding91.tistory.com/6
1์ฐจํ๊ฐ ํผ๋๋ฐฑ :
- ex00 -> ์๊ณ ๋ฆฌ์ฆ ํค๋์ ์ฐ์ด๋๊ฑฐ ์ฐพ์์ ์ ๊ฑฐ(transform)๋ฑ -> trimํ์ง ๋ง๊ณ ๊ทธ๋ฅ ๋ฐ๋ ๊ทธ๋๋ก ์ถ๋ ฅ.
-
ex01 -> ctrl - D ์์ธ์ฒ๋ฆฌ, ์ถ๋ ฅ ํ์์ด๋ ์์ ์กฐ์ (SEARCHํ๋ฉด ๋ฐ๋ก ์ธ๋ฑ์ค ์ฑ ์ด๋ฆ ๋๋ค์ ์์๋ก ์ถ๋ ฅ๋๊ณ , ์ดํ ์ธ๋ฑ์ค๋ฅผ ๋ฐ์์ ์์ธํ ์ ๋ณด ์ถ๋ ฅ๋๊ฒ.) - ex02 -> diff๊ฐ๋ฅํ๊ฒ ์ฃผ์ ์ถ๊ฐ, ์คํ์(amount)์์ .