C strings - byte, ubyte or char? (Discussion from Bugzilla)

Matti Niemenmaa see_signature at for.real.address
Thu Oct 4 09:32:00 PDT 2007


Stewart Gordon wrote:
> "Matti Niemenmaa" <see_signature at for.real.address> wrote in message
> news:fe2t70$2eka$1 at digitalmars.com...
>> But on second thought, having the cast (or a call to toStringz) be
>> necessary
>> might be better. If you want UTF-8 to be handled as encoding-agnostic, a
>> necessary cast may be a good idea, as it implies you know what you're
>> doing.
> 
> Why should I care that a function is encoding-agnostic if I know what
> encoding my text is in?  That sounds to me like suggesting that I should
> have to cast class instances explicitly to Object to prove I know that
> the function can use objects of any class.

You're right. I was going to write a long answer involving accidentally calling
an ubyte-taking function instead of a char-taking function when I realized that
having char implicitly convert to ubyte doesn't mean you can't overload
functions taking both. My bad!

-- 
E-mail address: matti.niemenmaa+news, domain is iki (DOT) fi



More information about the Digitalmars-d mailing list