포인터 키워드 구문

기술노트 60385

아키텍처:

All

컴포넌트:

compiler

업데이트:

2021-05-12 오전 2:44

소개

포인터와 그 키워드들에 대한 요약입니다. 일부 설명서에서는 이 정보를 찾기가 쉽지 않을 수 있습니다.

참고

CONST 키워드는 다른 키워드들과 다르게 동작합니다.

CONST 키워드 공식:

points_to int points_to * pointers_location constptr;

다른 키워드 공식:

pointers_location int points_to * pointers_location ptrname;

"다른 키워드"에 대해 "pointers location"를 한 번만 가질 수 있습니다.

예제

언급된 "키워드" (__near 와 __far2)는 IAR Systems 메모리 키워드 중 하나 일 수 있습니다. 또한 다른 제품들에 대해 다를 수 있습니다; 예를 들어 far, huge, near, tiny, idata, xdata, pdata, __near 등등..

/* CONST POINTERS */
const int * c1;
int const * c2;
int * const c3; /* Pointer is a constant pointer */
const int const * c4;
const int * const c5; /* Pointer is a constant pointer */
int const * const c6; /* Pointer is a constant pointer */
const int const * const c7; /* Pointer is a constant pointer */
/* POINTS TO NEAR */
__near int __near * n1; /* Pointer is located in NEAR */
int __near * __near n2; /* Pointer is located in NEAR */
__far2 int __near * n3; /* Pointer is located in FAR2 */
int __near * __far2 n4; /* Pointer is located in FAR2 */
/* POINTS TO FAR2 */
__near int __far2 * f1; /* Pointer is located in NEAR */
int __far2 * __near f2; /* Pointer is located in NEAR */
__far2 int __far2 * f3; /* Pointer is located in FAR2 */
int __far2 * __far2 f4; /* Pointer is located in FAR2 */

모든 제품 이름은 해당 소유자의 상표 또는 등록 상표입니다.

죄송하지만, 당사 사이트에서는 Internet Explorer를 지원하지 않습니다.보다 편안한 사이트를 위해 Chrome, Edge, Firefox 등과 같은 최신 브라우저를 사용해 주시길 부탁드립니다.