##의 쓰임새...

지송쪽팔려서의 이미지

안녕하세요..

대체 아래가 해석이 안되네요..

## 가 만일 paste operation이라고 하고 들여다 보면,

#define MODULE_GENERIC_TABLE(gtype,name) \ 
static const struct gtype##_id * __module_##gtype##_table \ 
__attribute__ ((unused, __section__(".data.exit"))) = name 
.
.
.

#define MODULE_DEVICE_TABLE(type,name) \ 
MODULE_GENERIC_TABLE(type##_device,name) 

이걸 어떻게 해석해야 합니까?
#define MODULE_DEVICE_TABLE(type,name)에 의미는
알겠습니다만... 위 전체를 놓고 파들어 가보면..
당췌 무슨 소린지..

위 소스 부분은...
module.h 에서 보실 수 있습니다.

가르쳐 주십시요..

먼저 감사의 인사를...

그럼..

sunyzero의 이미지

보통 많이 안쓰이기는 한데, 변수명 결합에 사용합니다.

즉 a##b 는 ab란 이름으로 되는거죠.

# 과 ##는 데니스 리치의 책에 나올겁니다. 아마도... 배운지 하두 오래되어서 나오는지는 장담할 수 없지만, 그때 배웠던것 같은 기억이 납니다.

========================================
* The truth will set you free.

skydancer의 이미지

sunyzero wrote:

# 과 ##는 데니스 리치의 책에 나올겁니다.

The C programming language 2nd ed wrote:

..........if the definition token sequence for either kind of macro contains a ## operator, then just after replacement of the parameters, each ## is deleted, together with any white space on either side, so as to concatenate the adjacent tokens and form a new token............

라는 군요.

웃어요^,.^;