-
Notifications
You must be signed in to change notification settings - Fork 49
basic/advanced_type/enum #261
-
basic/advanced_type/enum
简单、快速地学习 Zig,ziglang中文教程,zig中文教程
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 4 replies
-
EnumLiteral部分用法是不是有错误 还是我理解错误?
我看官方好像是这样
const EnumLiteral: type = @Type(.enum_literal);
Beta Was this translation helpful? Give feedback.
All reactions
4 replies
-
你是指枚举量的形式不同吗
这个没什么要求
Beta Was this translation helpful? Give feedback.
All reactions
-
因为我是看着教程写的
const EnumLiteral: type = @Type(.EnumLiteral);
这种写法是无法编译通过的,报错信息:union 'builtin.Type' has no member named 'EnumLiteral',如果我改为@Type(.enum_literal),他就可以编译通过,因为enum_literal他是在std.builtin.Typeunion内的
也有可能是 我还是个小白 没理解教程里具体是什么意思 或许 再回头看的时候 就明白了
Beta Was this translation helpful? Give feedback.
All reactions
-
我明白你的意思了,这里是教程的错误,EnumLiteral这个写法是旧版本的写法,新的版本对类型变量做了修改调整,zig-course这边忘记改这个了
Beta Was this translation helpful? Give feedback.
All reactions
-
今天稍晚些我会纠正该问题
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment