. filename
. suffix
. C++ implementation : *.cpp
. C++ include : *.h
. include files
. 중복 inclusion을 막아야함. #define 등 이용
. include 디렉토리는 절대경로가 아닌 상대경로만 적을 것
. Assigning Names
. Pascal case: The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized.
ex) BackColor
. Camel case: The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized.
ex) backColor
. user-defined type 이름과 struct, class 이름은 pascal case
. interface는 I로 시작함
. function, memberfunction : camel case, 동사 + 목적어
ex) getName, setName
. member variable : camel case, 'm_' prefix로 시작함
ex) m_name, m_count
. static member variable : camel case, 's_' prefix로 시작함
ex) s_name, s_count
. parameter name : camel case
. global variable : 'g_' prefix camel case
. pointer variable : hungarian notation, p로 시작
ex) int *pCount
ex)
struct Beer;
enum BeerStyle;
class PublicBar
{
public:
int m_beerSold;
Beer getSomeBeer(BeerStyle beerStyle);
static int s_remainingBeer;
private:
bool m_beerInSale;
void calculateRemainingBeer();
};
PublicBar g_publicBar;
PublicBar & GetPublicBar();
. indentation : 공백 4칸
. comment : doxygen style을 이용한다.
. 괄호
if문은 1줄일 때도 {} 이용
if (조건)
{
}
댓글 없음:
댓글 쓰기