Hi guys,
I’m trying to give some standard library function an argv parameter. They ask for this type: [:null]const?[:0]const u8.
How do I initialize this monstrocity? Specifically, I want to:
Hi guys,
I’m trying to give some standard library function an argv parameter. They ask for this type: [:null]const?[:0]const u8.
How do I initialize this monstrocity? Specifically, I want to:
submitted before I intended…
I want to:
Thank you,
const NullableStr = ?[*:0]const u8;
// the _ means infer the array size pls
const a: [*:null]const NullableStr = &[_:null]const NullableStr{
&[_:0]u8{ 'f', 'o', 'o', 0 },
&[_:0]u8{ 'b', 'a', 'r', 0 },
null,
};
// or
const a: [*:null]const NullableStr = &[_:null]const NullableStr{
"foo",
"bar",
null,
};
Notice that a pointer to a sized array &[_]...
can coerce to a pointer to multiple item [*]...
. That applies to the sentinel version.