是否有可能在常量上下文中使用函數的參數?例如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嗎?如果不是,為什么?
- 1 回答
- 0 關注
- 106 瀏覽
添加回答
舉報
0/150
提交
取消