#noindex [[메모리,memory]]상의 위치를 가리키는 변수인가 아님 그런 변수의 [[형,type]]([[타입,type]]으로 pagename determined.)인가? { 메모리 * 할당 - malloc * 해제 - free * 누수 * 포인터 * 주소 메모리 관련 [[C언어]] 함수 ||함수 ||원형 ||하는 일 ||리턴값 || ||memset ||void *memset(void *str, int c, size_t n) ||memset(위치, 값, 크기). 위치에 값을 크기만큼 채우기 ||str (이것 관련해서 hn에서 논쟁이 있었는데..TBW)|| ||memcpy || ||memccpy ||void *memccpy(void *dest, const void *src, int c, size_t n); ||src에서 dest로 n바이트 복사하며 도중에 문자 c를 만나면....TBW || ||memmove || ||memchr || ||메모리에서 문자 찾기 || ||memcmp || ||memicmp || ||대소문자 구분없이 비교 || } Sub: [[포인터산술,pointer_arithmetic]] { 덧셈은 의미가 없고 [[뺄셈,subtraction]]은 [[주소,address]] [[메모리주소,memory_address]]의 차이이고, 등등. [[포인터,pointer]] [[산술,arithmetic]] } [[널포인터,null_pointer]] - [[널,null]] [[null_pointer_assignment]] - [[에러,error]] .... [[널포인터,null_pointer]] [[할당,assignment]] -> [[널포인터할당,null_pointer_assignment]] ?? [[포인터분석,pointer_analysis]] ---- LINKTHESE: [[주소,address]] [[메모리_관리,memory_management]] ... 보단 [[메모리관리,memory_management]] MMU [[메모리_할당,memory_allocation]] ... 보단 [[메모리할당,memory_allocation]] [[동적_메모리_할당,dynamic_memory_allocation]] ...보단 [[동적메모리할당,dynamic_memory_allocation]] { 할당받은 메모리는 사용이 끝나면 해제(free)해야 함. [[C언어]]는 수동 해제해야 하 며, garbage collection을 지원하는 언어는 사용되지 않는 메모리를 자동으로 해제함. 동적 메모리를 해제하지 않아서 가용 메모리가 줄어드는 현상은 memory_leak. } garbage_collection reference - [[참조,reference]] =참조,reference =,reference . { [[포인터,pointer]]가 '''참조,reference'''를 하려면, 대상의 [[주소,address]] esp [[메모리주소,memory_address]]가 필요? 포인터가 값을 갖는(포인터에 주소를 [[대입,assignment]]하는) 것 ≡ 포인터가 대상/target/[[객체,object]]를 가리키는 것? self-reference 자기참조? 자신참조? (VG "self-reference"을(를) 전체 찾아보기 => http://tomoyo.ivyro.net/123/wiki.php/FindPage?action=fullsearch&value=self-reference&context=20&case=1 ) { https://en.wikipedia.org/wiki/Self-reference ... Google:self-reference } WpKo:참조 = https://ko.wikipedia.org/wiki/참조 [[WpEn:Reference_(computer_science)]] = https://en.wikipedia.org/wiki/Reference_%28computer_science%29 } referencing a pointer dereference { } call_by_reference { [[참조,reference]] [[호출,call]] } reference_counting =,reference_counting . reference_counting { [[참조,reference]] [[counting]] 셈/세기/... https://ko.wikipedia.org/wiki/참조_횟수_계산_방식 https://en.wikipedia.org/wiki/Reference_counting REL: memory_management > garbage_collection } [[memory_leak]] ---- [[TableOfContents]] = 포인터란 = [[주소,address]](esp [[메모리,memory]]의 [[메모리주소,memory_address]])를 담는 [[변수,variable]]. i.e. 포인터에 들어가는 값은 메모리 주소. 메모리상의 어떤 위치. 보통 machine의 [[워드,word]] size (word_size) 또는 [[레지스터,register]] size (register_size) 에 따른? C에서 선언은 {{{ char *i; int *j; }}} *가 typename에 붙는가, variable name에 붙는가에 대한 convention도 있는데 나중에. = 포인터 연산자 pointer operator = C의 경우 ||& ||주소 구하기 연산자 || ||* ||간접 참조 연산자 || ++, -- 에 대해선 아래 포인터의 증감 section에 = 포인터의 증감 = C의 경우 포인터에 증감(증가 increment ++ 감소 decrement --) 연산을 하면, 그 값이 하나씩 변하는 것이 아니라 (포인터가 가리키는 type?)의 size만큼 증감. = 포인터와 배열 = [[배열,array]] [[인덱스,index]] [[첨자,index]] 로 접근 C의 경우 다음 둘이 equivalent {{{ *(arr+i) a[i] }}} 이건 syntactic_sugar ? = 포인터와 문자열 = [[문자열,string]] C에선 따로 문자열 [[형,type]]이 없고 `char*`을 문자열형처럼 쓰는데.. 이것도 syntactic_sugar ? = 이중 포인터 = 이중포인터가 가리키는 곳을 참조하려면 {{{ **p }}} = Dangling pointer = AKA '''미결합 포인터, 댕글링 포인터, 허상 포인터(WpKo), 와일드 포인터(wild pointer)''' [[dangling_pointer]] rel. [[dangling_reference]] - 존재하지 않는 것에 대한 [[참조,reference]]? Ex. {{{ #include void func(int *p) { int b = 10; p = &b; printf("*p = %d\n", *p); } int main() { int *a; func(a); printf("*a = %d\n", *a); } }}} WpKo:허상_포인터 = https://ko.wikipedia.org/wiki/허상_포인터 WpEn:Dangling_pointer = https://en.wikipedia.org/wiki/Dangling_pointer = void 포인터 (C) = {{{ int main() { int i = 0; float f = 1.0f; void *p; p = &i; *(int *)p = 2; p = &f; *(float *)p = 3.0f; } }}} = near/far 포인터 (16bit IBM PC) = 보통 [[도스,DOS]]에서 씀 ([[Win16]]에서는?) [[windef.h]]에 정의되는데 [[Win32]]로 바뀌면서 빈 문장으로 처리하도록 변경됨. 16비트 환경에서는 far 포인터 관련 함수가 ||malloc ||farmalloc || ||calloc ||farcalloc || ||realloc ||farrealloc || ||memset ||_fmemset || 등의 near와 다른 별도의 함수로 분리되어 있음. 매크로 { MK_FP(seg, ofs) 16비트 segment와 offset을 받아 far pointer를 만들어 줌 FP_SEG(fp) far pointer에서 세그먼트 추출 FP_OFF(fp) far pointer에서 오프셋 추출 } = smart pointer (C++ etc) = smart_pointer =,smart_pointer . smart_pointer https://en.wikipedia.org/wiki/Smart_pointer == auto_ptr (C++) == "The C++11 standard made '''auto_ptr''' deprecated, replacing it with the unique_ptr class_template. '''auto_ptr''' was fully removed in C++17"(we) https://en.wikipedia.org/wiki/Auto_ptr = ptrdiff_t (C/C++) = 두 포인터의 [[뺄셈,subtraction]], [[차이,difference]] // rel. pointer_arithmetic C: https://en.cppreference.com/w/c/types/ptrdiff_t C++: https://en.cppreference.com/w/cpp/types/ptrdiff_t = thin/fat = thin_pointer fat_pointer Ggl:"thin fat pointer" thin pointer fat pointer = bounded = bounded pointer bounded_pointer https://en.wikipedia.org/wiki/Bounded_pointer = tagged = tagged tagged pointer tagged_pointer rel. reference_count reference_counting https://en.wikipedia.org/wiki/Reference_counting (Redirected from WpEn:Reference_count) WtEn:tagged_pointer https://en.wikipedia.org/wiki/Tagged_pointer 이름의 유래 관련: { tagged_architecture tagged architecture https://en.wikipedia.org/wiki/Tagged_architecture Ggl:"tagged architecture" [[컴퓨터구조,computer_architecture]] tagged union Ggl:"tagged union" [[공용체,union]]? [[태그,tag]] [[tagged]] } ---- [[WpKo:포인터_(프로그래밍)]] [[WpEn:Pointer_(computer_programming)]] 비슷한단어 [[포인트,point]]