dmedia.dprogramming.com - two new tutorials

Hasan Aljudy hasan.aljudy at gmail.com
Sun May 7 16:02:44 PDT 2006


Tom S wrote:
> Hasan Aljudy wrote:
> 
>> Nice! I just started reading, and noticed you're using toStringz for 
>> strings.
>> I've tried using SDL with D before, and I noticed that you don't need 
>> to use toStringz at all, for example, this works just fine:
>>
>> SDL_WM_SetCaption("My SDL Window", null);
>>
>> at least it worked when I tried it.
> 
> 
> Please, please, please read the whole thing before you write comments 
> like this one :S
> Quote from my article:
> 
> `But then if you know the D specification inside-out, you might say 
> “Hey, but when the compiler allocates space for string literals, it 
> inserts an additional zero just after that memory range !”. Calm down, 
> please, you can remove the toStringz function call and its associated 
> import if you know what you're doing. But if someone wanted to have a 
> window with some dynamically - generated caption, they would be in some 
> serious trouble.`
> 
> 

oops, my mistake.
I apologize :(



More information about the Digitalmars-d-learn mailing list