[swift-users] Ambiguous error for setting a value in a CChar array
adam.92.ac at gmail.com
Thu Mar 3 21:54:46 CST 2016
Discovered this when trying to answer a stackoverflow question about
setting character values in a CCString array.
The following code produces an ambiguous error:
var buff = [CChar](count: 5, repeatedValue: 0)
buff = "A".utf8.first!.value // Error - Cannot assign value of type
'Int8' to type 'CChar' (aka 'Int8')
I can easily get around this by changing the second line to:
buff.value = "A".utf8.first!.value
Can someone explain what is happening here? As well as the significance of
Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-users