Skip to content

CodeConvention

Yòmá edited this page Jan 3, 2023 · 9 revisions

클래스 Class

  • 클래스 이름의 첫번째는 대문자

The first letter of the class name is a capital letter (uppercase)

typedef Class SomeClass {
   ...
   ...
} some_class_t;

함수 Functions

  • 함수는 기본적으로 snake_case 사용

The function uses a snake_case.

  • 리턴타입 \n 함수명(전달인자)

format {return type} (newline) function_name(arguemtns) {}

int
main(void){
/* main_content */
}
  • 멤버함수는 마지막에 _ 표기

Use _ at the end of the member variable ex)

class Parser {
    private:
        int _number;

        int get_number_(void);
}
  • static 함수들은 이름없는 namespace로 관리

The static function uses an unnamed namespace

  • static 함수들은 마지막에 __표기

Use __ at the end of the member variable

namespace {
  void 
  get_next_crlf__(char * str){
    ...
  }
}

변수 Variables

  • 변수는 기본적으로 snake_case 사용

The variable uses a snake_case.

  • 멤버변수는 처음에 _ 표기

Use _ at the front of the member variable ex)

class Parser {
    private:
        int _number;
}
  • 지역변수는 값 or 포인터 선언

Declare location variables with value or pointer. ex)

int
some_function(int const& input){
   int  a = 0;
   int* b = &input;
}

Clone this wiki locally