Update documentation

This commit is contained in:
Sofia 2025-07-28 21:23:51 +03:00
parent 89850d7b4f
commit 014ba2f638
2 changed files with 5 additions and 5 deletions

View File

@ -11,10 +11,10 @@ for the binary operators, because there are hundreds of those).
#### `<T>::sizeof() -> u64`
Simply returns the size of type `T` in bits.
Simply returns the size of type `T` in bytes.
```rust
i32::sizeof(); // Returns 32
i32::sizeof(); // Returns 4
```
#### `<T>::null() -> *T`
@ -25,9 +25,9 @@ Returns a null-pointer of type `T`.
i32::null(); // Returns *i32 (null-ptr)
```
#### `<T>::alloca(size: u64) -> *T`
#### `<T>::malloc(size: u64) -> *T`
Allocates `T::sizeof() * size` bits and returns a pointer to `T`.
Allocates `T::sizeof() * size` bytes and returns a pointer to `T`.
**Note:** This does not seem to work correctly currently.

View File

@ -25,7 +25,7 @@ fn main() -> u32 {
print(from_str("sizeof i32: ") + i32::sizeof());
let nullptr = i32::null();
let mut list = u64::alloca(15);
let mut list = u64::malloc(15);
list[4] = 17;
print(from_str("value: ") + list[4]);