블로그 이미지
Flying Mr.Cheon youGom

Recent Comment»

Recent Post»

Recent Trackback»

« 2025/5 »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

c++ 고급

소프트웨어 공학/개발 | 2011. 8. 24. 17:47 | Posted by youGom
1. define
#define 문으로 선언된 상수는 컴파일시 Symbol 정보가 남지 않는다.
그래서, 디버깅할때 간혹, 심볼 추적 안되는 것 같다.


2. constexpr
int getCount( int c ) { return c + 1; }
int arr[ getCount( 1 ) ];

 위 내용은 일반적으로 컴파일되지않는다.
 
constexpr int getCount( int c ) { return c + 1; }
int arr[ getCount( 1 ) ];
 위와 같이 constexpr 키워드를 사용하면 컴파일시 정해진다.





 
: