[swift-evolution] [Draft] Target-specific CChar

Brent Royal-Gordon brent at architechies.com
Thu Mar 3 04:05:36 CST 2016

>>>> Could we treat CChar as a "signless" byte type, so that UInt8(cchar) and Int8(cchar) both just reinterpret the bit pattern?
>>> That is viable, but it opens a whole another can of worms:
>>> - we need CChar to be a separate type,
>>> - other unlabelled integer initializers trap when changing the numeric
>>> value, and this one would be wildly inconsistent.
>> ... but if we don't provide any arithmetic operations on the CChar
>> type, and treat it as an opaque byte-sized character type that you can
>> only convert to UInt8/Int8, it might not be bad!
> Yeah, it would make sense to me if CChar were opaque and you had to construct an Int8 or UInt8 from it to specify the arithmetic semantics you want.

I know we're planning to remove `RawByte`, but might it make sense to give it a stay of execution, import `char` as `RawByte`, and add appropriate initializers to convert between it and `Int8`/`UInt8`?

Brent Royal-Gordon

More information about the swift-evolution mailing list