- C++/상수 constexpr 값 이름 앞에 g_ prefix를 붙여도 될까 . . . . 8 matches
#keywords C++, constexpr
C++ 11 에서 새롭게 도입되고 C++14에서 향상된 constexpr 키워드는 컴파일 타임 상수를 의미하며 변수 앞에 적용될 수 있다.
그래서 전역 변수를 쓸 때처럼 constexpr를 정의하면 마치 g_ prefix를 붙여야 할 것 같이 느껴질 수 있다.
❓ 그런데 constexpr은?
constexpr은 컴파일 타임 상수이다.
constexpr 값에는 안 붙이는 게 좋다.
constexpr float kDefaultDpi = 96.0f; // Google C++ 스타일
constexpr float DefaultDpi = 96.0f; // 일반적인 modern C++ 스타일
- C++ . . . . 1 match
["/상수 constexpr 값 이름 앞에 g_ prefix를 붙여도 될까"]
Found 2 matching pages out of 1230 total pages (0 pages are searched)
You can also click here to search title.