Skip to Content
이펙티브 러스트
book

이펙티브 러스트

by 데이비드 드라이스데일, 남기혁
October 2024
Beginner to intermediate
344 pages
7h 44m
Korean
Hanbit Media, Inc.
Content preview from 이펙티브 러스트
79
1
타입
전에 먼저 원하는 기능을 제공하는 크레이트(예:
derive
_
builder
)가 나와 있는지부터 확인
해야 한다. 물론 그로 인해 발생하는 의존성을 감당해야 한다 (아이템
25
).
아이템
8
: 레퍼런스와 포인터 타입에 익숙해져라
프로그래밍에서 흔히 말하는
레퍼런스 (참조 )
reference
란 어떤 데이터 구조를 직접 소유한 변수
를 사용하지 않고 그 데이터 구조에 간접적으로 접근하는 수단이다. 레퍼런스는 대체로 포인
pointer
로 구현한다. 포인터는 데이터 구조의 메모리 주소를 값으로 갖는다.
최신
CPU
는 대부분 포인터에 몇 가지 제약 조건을 적용한다. 가령 메모리 주소는 가상 또는
실제 메모리 범위 안에 있어야 하고, 정렬
align
돼야 한다. 예를 들어
4
바이트 정숫값에 접근하려
면 주소가
4
의 배수여야 한다.
그런데 고수준 프로그래밍 언어는 포인터에 대한 정보를 타입 시스템으로 인코딩하는 경향이
있다. 러스트를 비롯한
C
기반 언어에서 제공하는 포인터는 자신이 가리키는 메모리 주소 지점
에 나올 수 있는 데이터 구조의 타입 정보도 담고 있다. 따라서 포인터를 통해 주소가 가리키는
메모리 공간에 담긴 내용뿐만 아니라, 그다음 지점에 담긴 내용도 해석할 수 있다.
이런 기본적인 포인터 정보(예상 메모리 위치와 데이터 구조 레이아웃)를 러스트에서는
원시
포인터
raw
pointer
라고 표현한다. 하지만 안전한 러스트 코드라면 원시 포인터를 사용하지 않고,
안전 보장과 제약 조건이 강화된 포인터와 레퍼런스를 사용한다.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

이펙티브 타입스크립트

이펙티브 타입스크립트

Dan Vanderkam
파이썬으로 살펴보는 아키텍처 패턴

파이썬으로 살펴보는 아키텍처 패턴

오현석, 해리 퍼시벌, 밥 그레고리

Publisher Resources

ISBN: 9791169212946