Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add uninitialized intrinsic #522

Merged
merged 1 commit into from
Dec 19, 2024
Merged

Add uninitialized intrinsic #522

merged 1 commit into from
Dec 19, 2024

Conversation

kengorab
Copy link
Owner

This effectively just results in a null pointer, but it's cast to be whatever generic value T it's required to be. This can be dangerous of course and requires additional checks, but is useful in cases where performance is important (like with MapEntry<K, V>[] in the Map type); this approach can be leveraged instead of using Option<T>. It's much less ergonomic and type-safe, but it doesn't result in an extra layer of allocation and pointer-indirection.

This effectively just results in a null pointer, but it's cast to be
whatever generic value `T` it's required to be. This can be dangerous of
course and requires additional checks, but is useful in cases where
performance is important (like with `MapEntry<K, V>[]` in the `Map`
type); this approach can be leveraged instead of using `Option<T>`.
It's much less ergonomic and type-safe, but it doesn't result in an
extra layer of allocation and pointer-indirection.
@kengorab kengorab merged commit fddda54 into master Dec 19, 2024
1 check passed
@kengorab kengorab deleted the uninitialized-intrinsic branch December 19, 2024 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant