string is rarely useful as a function argument
Chad J
chadjoan at __spam.is.bad__gmail.com
Sun Jan 1 07:13:29 PST 2012
On 01/01/2012 07:59 AM, Timon Gehr wrote:
> On 01/01/2012 05:53 AM, Chad J wrote:
>>
>> If you haven't been educated about unicode or how D handles it, you
>> might write this:
>>
>> char[] str;
>> ... load str ...
>> for ( int i = 0; i< str.length; i++ )
>> {
>> font.render(str[i]); // Ewww.
>> ...
>> }
>>
>
> That actually looks like a bug that might happen in real world code.
> What is the signature of font.render?
In my mind it's defined something like this:
class Font
{
...
/** Render the given code point at
the current (x,y) cursor position. */
void render( dchar c )
{
...
}
}
(Of course I don't know minute details like where the "cursor position"
comes from, but I figure it doesn't matter.)
I probably wrote some code like that loop a very long time ago, but I
probably don't have that code around anymore, or at least not easily
findable.
More information about the Digitalmars-d
mailing list