Skip to content

Commit 68adc59

Browse files
committed
commented out for original sentences
1 parent e3db54d commit 68adc59

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/unsafe.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ fn main() {
4949
}
5050
```
5151

52+
<!--
53+
### Calling Unsafe Functions
54+
Some functions can be declared as `unsafe`, meaning it is the programmer's
55+
responsibility to ensure correctness instead of the compiler's. One example
56+
of this is [`std::slice::from_raw_parts`] which will create a slice given a
57+
pointer to the first element and a length.
58+
-->
5259
### 安全でない関数呼び出し
5360
いくつかの関数は `unsafe` として宣言できます。これはコンパイラの代わりにプログラマの責任で正しさを保証することを意味します。
5461
例として [`std::slice::from_raw_parts`] があります。この関数は最初の要素へのポインタと長さを指定してスライスを作成します。
@@ -70,6 +77,12 @@ fn main() {
7077
}
7178
```
7279

80+
<!--
81+
For `slice::from_raw_parts`, one of the assumptions which *must* be upheld is
82+
that the pointer passed in points to valid memory and that the memory pointed to
83+
is of the correct type. If these invariants aren't upheld then the program's
84+
behaviour is undefined and there is no knowing what will happen.
85+
-->
7386
`slice::from_raw_parts` は、以下の仮定に基づいて処理します。
7487
- 渡されたポインタが有効なメモリ位置を指していること
7588
- そのメモリに格納された値が正しい型であること

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy