是否有可能在常量上下文中使用函数的参数?
例如
func example(size int) {
one := [size]int{} // Error: non-constant array bound 'size'
const two = size // Error: const initializer 'size' is not a constant
}在这些情况下不是有效常数size吗?如果不是,为什么?
呼如林
慕慕森
随时随地看视频慕课网APP
相关分类