You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/items/external-blocks.md
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -179,9 +179,15 @@ unsafe extern "C" {
179
179
unsafefnfoo(...);
180
180
unsafefnbar(x:i32, ...);
181
181
unsafefnwith_name(format:*constu8, args:...);
182
+
// SAFETY: This function guarantees it will not access
183
+
// variadic arguments.
184
+
safefnignores_variadic_arguments(x:i32, ...);
182
185
}
183
186
```
184
187
188
+
> [!WARNING]
189
+
> The `safe` qualifier should not be used on a function in an `extern` block unless that function guarantees that it will not access the variadic arguments at all. Passing an unexpected number of arguments or arguments of unexpected type to a variadic function may lead to [undefined behavior][undefined].
0 commit comments