April 21, 2007
My stupidity, I was forgetting the [] in the cast

Jascha Wetzel wrote:
> it already evaluates as expected if you cast to wchar
> 
> ->= str
> {
>   [0] = 0x0048,
>   [1] = 0x0065,
>   [2] = 0x006c,
>   [3] = 0x006c,
>   [4] = 0x006f
> }
> ->= cast(wchar[])str
> "Hello"
> 
> dckl wrote:
>> Well maybe 1.014 will fix the problem :)
>>
>> Would it be possible to have it evaluate if cast to a wchar ?
>>
>>
>> Jascha Wetzel wrote:
>>> wrong - the wchar problem will not be fixed. DMD uses ambiguous CV types
>>> here (wchar[] = ushort[]) - bugzilla #1104
>>>
>>> Jascha Wetzel wrote:
>>>  
>>>> thanks!
>>>> both fixed in the next release
>>>>
>>>> dickl wrote:
>>>>    
>>>>> The following code will show the debugger break at places where break
>>>>> points are not set.
>>>>>
>>>>> Also, the wchar[] str doesn't evaluate properly.
>>>>>
>>>>> -----------------------------------------
>>>>>
>>>>>
>>>>> import std.stdio;
>>>>>  import std.utf;
>>>>>
>>>>>  int main()
>>>>>  {
>>>>>
>>>>>  // cast(wchar)str doesn't evaluate properly in ddbg 0.1.1
>>>>>      wchar [] str = toUTF16(cast(char [])"Hello");
>>>>>
>>>>>  // set a break point here (line 10)
>>>>>      writefln(str);
>>>>>  //single step (over) until inside of the foreach loop
>>>>>      Test t = new Test;
>>>>>
>>>>>
>>>>>      foreach(wch;t)
>>>>>      {
>>>>>          wchar c = wch;
>>>>>  // dispite doing a step (over), ddbg will stop inside of the onApply
>>>>>  // doing a continue from this point , ddbg will break on the foreach
>>>>> statement
>>>>>          writefln(c);
>>>>>      }
>>>>>
>>>>>      return 0;
>>>>>  }//end int main()
>>>>>
>>>>>
>>>>>  class Test
>>>>>  {
>>>>>     wchar [] str;
>>>>>
>>>>>    this()
>>>>>    {
>>>>>        str=toUTF16(cast(char [])"Hello Again");
>>>>>    }
>>>>>
>>>>>
>>>>>      int opApply(int delegate(inout wchar wch) dg)
>>>>>      {
>>>>>          int result=0;
>>>>>          for(uint i=0;i<str.length;i++)
>>>>>          {
>>>>>              result=dg(str[i]);
>>>>>              if(result)
>>>>>                  break;
>>>>>          }
>>>>>          return result;
>>>>>      }
>>>>>  }//end class Test
>>>>>       
1 2
Next ›   Last »