Skip to content

Strings from builtin functions should be null terminated if needed #3779

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

Closed
Vexu opened this issue Nov 26, 2019 · 3 comments
Closed

Strings from builtin functions should be null terminated if needed #3779

Vexu opened this issue Nov 26, 2019 · 3 comments
Labels
accepted This proposal is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone

Comments

@Vexu
Copy link
Member

Vexu commented Nov 26, 2019

@embedFile, @errorName, @memberName, @tagName and @typeName should be able to return null terminated slices so this would work:

const name: [*:0]u8 = @tagName(E.SomeEnum);
@andrewrk andrewrk added accepted This proposal is planned. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. labels Nov 27, 2019
@andrewrk andrewrk added this to the 0.6.0 milestone Nov 27, 2019
@andrewrk
Copy link
Member

They should also be updated to return pointers to arrays rather than slices when the length is comptime known. It goes along with the same ideas behind #863.

@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Mar 20, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 9, 2020
@jmc-88
Copy link
Contributor

jmc-88 commented Apr 28, 2021

For the record, @memberName was removed in 45da72c and 3458fb8, though there's still a reference to it in a commented out code block:

// return @unionInit(EnumUnion, @memberName(EnumUnion, 0), result);

@jmc-88
Copy link
Contributor

jmc-88 commented Jul 19, 2021

Now that #9183 too has been merged, I think the only outstanding builtin would be @typeInfo(), which has been forked to #9182. Maybe this can be closed?

@Vexu Vexu closed this as completed Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This proposal is planned. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned.
Projects
None yet
Development

No branches or pull requests

3 participants