| |||
| Home > 컴파일러 관련 기능 > 함수 특성 | |||
__attribute__ 키워드를 사용하면 변수 또는 구조체 필드, 함수
및 유형의 특별한 특성을 지정할 수 있습니다. 키워드의 형식은 다음 중 하나입니다.
__attribute__ ((attribute1,attribute2, ...)) __attribute__ ((__attribute1__,__attribute2__, ...))
예를 들면 다음과 같습니다.
void * Function_Attributes_malloc_0(int b) __attribute__ ((malloc)); static int b __attribute__ ((__unused__));
Table 4.3에는 사용할 수 있는 함수 특성이 요약되어 있습니다.
Table 4.3. 컴파일러에서 지원하는 함수 특성 및 해당 항목
| 함수 특성 | 특성이 아닌 해당 항목 |
|---|---|
__attribute__((alias)) | - |
__attribute__((always_inline)) | __forceinline |
__attribute__((const)) | __pure |
__attribute__((deprecated)) | - |
__attribute__((malloc)) | - |
__attribute__((noinline)) | __declspec(noinline) |
__attribute__((noreturn)) | __declspec(noreturn)) |
__attribute__((pure)) | - |
__attribute__((unused)) | - |
__attribute__((used)) | - |
__attribute__((weak)) | __weak |