We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
/* struct A { int size: 10; // 位字段无法访问 float arr[]; // 零长的数组也无法访问 }; */ import "C" import "fmt"
func main() { var a C.struct_A fmt.Println(a.size) // 错误: 位字段无法访问 fmt.Println(a.arr) // 错误: 零长的数组也无法访问 } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ int size: 10 无法访问。 int size: 8、16或者32。 可以访问,打印结果:a.size=0。
The text was updated successfully, but these errors were encountered:
零长的数组好像是C99的特性,如果C++不支持可以用 float arr[1] 先绕过
float arr[1]
Sorry, something went wrong.
chai2010
No branches or pull requests
/*
struct A {
int size: 10; // 位字段无法访问
float arr[]; // 零长的数组也无法访问
};
*/
import "C"
import "fmt"
func main() {
var a C.struct_A
fmt.Println(a.size) // 错误: 位字段无法访问
fmt.Println(a.arr) // 错误: 零长的数组也无法访问
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
int size: 10 无法访问。
int size: 8、16或者32。 可以访问,打印结果:a.size=0。
The text was updated successfully, but these errors were encountered: