Skip to content

make empty_array storage to be constexpr - #1689

Open
Shamzik wants to merge 1 commit into
masterfrom
kshamazov/constexpr_empty_array_storage
Open

make empty_array storage to be constexpr#1689
Shamzik wants to merge 1 commit into
masterfrom
kshamazov/constexpr_empty_array_storage

Conversation

@Shamzik

@Shamzik Shamzik commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Protects the empty array instance from accidental modifications.

Problem

The global empty array instance lacked strict compile-time protection against mutability.

Solution

Enforced Const Correctness: Marked the internal static empty_array representation as constexpr to ensure it is evaluated at compile time and placed in read-only memory.

Impact

Enhances memory safety by guaranteeing that the empty array state cannot be accidentally altered at runtime.

@Shamzik Shamzik self-assigned this Sep 4, 2026
@Shamzik Shamzik added runtime Feature related to runtime k2 Affects compiler or runtime in K2 mode kphp Affects compiler or runtime in default mode (not K2) labels Sep 4, 2026
@Shamzik Shamzik added this to the next milestone Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

k2 Affects compiler or runtime in K2 mode kphp Affects compiler or runtime in default mode (not K2) runtime Feature related to runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant