Why compiler says `error: no spread elements allow...
# kotlin-native
r
Why compiler says
error: no spread elements allowed here
for this code?
Copy code
immutableBinaryBlobOf(*(name.toCharArray() as ShortArray))
s
Because spread operator
*
is not allowed in
immutableBinaryBlobOf
. The latter must be evaluated in compile time, and having
*
among arguments complicates this.
a
Okay... Maybe you advise me the best way to create
immutableBinaryBlobOf
from compile time String constant?
s
I’m not sure it is possible currently. Why do you need this?
r
See question above. Mike Sinkovsky gave advice about forwarding args as compile-time constant for using in macro
s
If I understand correctly, it appeared to be unrelated: https://kotlinlang.slack.com/archives/C3SGXARS6/p1533647735000300?thread_ts=1533629726.000018&cid=C3SGXARS6 It doesn’t matter for C wrapper whether you pass stable pointer to constant string or not, because
sizeof(name)
would be incorrect there in any case, since
name
expands to
arg
which is parameter of type
char*
.
r
sadly