Array expressions
ArrayExpression = "[" , ArrayExprItems , "]"
;
ArrayExprItems = ExpressionWithoutBlock , { ",", ExpressionWithoutBlock } , [ "," ]
| ExpressionWithoutBlock , ";" , NumberLiteral
;
Bulk fill
Assigning a repeat expression ([value; N]) directly to a
global variable whose array type is larger than
16 bits lowers to a runtime fill loop instead of materializing the array in a local:
global OAM: [u8; 160];
fn main() {
OAM = [0; 160]; // runtime fill loop
}
This is restricted to:
- array item types
u8/i8(other item types are not yet supported) - a
valuethat is a compile-time-constant literal integer (optionally negated fori8) - a runtime-computed value, or a reference to a const item, is not yet supported
See bulk copy in operator expressions for copying an oversized array/struct from another global or const.