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

std.meta: have fieldNames() return a mutable pointer to array #15968

Closed
wants to merge 1 commit into from

Conversation

nektro
Copy link
Contributor

@nektro nektro commented Jun 7, 2023

function value is only computed at comptime so returning the address local is safe and this allows the result to for instance be sorted without an extra copy

function value is only computed at comptime so returning the address local is safe and this allows the result to for instance be sorted without an extra copy
@rohlem
Copy link
Contributor

rohlem commented Jun 7, 2023

In my understanding, pointers to comptime stack variables can be "leaked"/returned at comptime,
but their memory should become const according to accepted #7396.

@nektro
Copy link
Contributor Author

nektro commented Jun 7, 2023

I was doing the sorting also at comptime but this patch is perhaps the wrong way to go about it since if the type becomes runtime it becomes more likely to cause a segfault

@nektro nektro closed this Jun 7, 2023
@nektro nektro deleted the patch-7 branch June 7, 2023 17:31
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.

2 participants