Skip to content

Commit 9b221d7

Browse files
Document macro versions of sizeof and alignof (#823)
Co-authored-by: Julien Portalier <[email protected]>
1 parent dafc287 commit 9b221d7

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/syntax_and_semantics/alignof.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ The argument to alignof is a [type](type_grammar.md) and is often combined with
3838
a = 1
3939
alignof(typeof(a)) # => 4
4040
```
41+
42+
`alignof` can be used in the macro language, but only on types with stable size and alignment. See the API docs of [`alignof`](https://crystal-lang.org/api/Crystal/Macros.html#alignof(type):NumberLiteral-instance-method) for details.

docs/syntax_and_semantics/sizeof.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ The argument to sizeof is a [type](type_grammar.md) and is often combined with [
2323
a = 1
2424
sizeof(typeof(a)) # => 4
2525
```
26+
27+
`sizeof` can be used in the macro language, but only on types with stable size and alignment. See the API docs of [`sizeof`](https://crystal-lang.org/api/Crystal/Macros.html#sizeof(type):NumberLiteral-instance-method) for details.

0 commit comments

Comments
 (0)