Iteration on UTF/UNICODE characters

Eugene Wissner belka at caraus.de
Tue Sep 11 09:32:51 UTC 2018


On Tuesday, 11 September 2018 at 08:54:33 UTC, Danny Arends wrote:
> Hey all,
>
> I am building a font glyph atlas for 2D and 3D rendering using 
> the following code:
>
> dchar c = '\u0000';
> while (c <= '\U0000FFFF') {
>   if(isValidDchar(c)){
>     # Code working on the char
>   }
> }
>
> This compiles, and works as expected using DMD, and LDC2.
>
> However when I try and build the code using GDC, it gives me 
> the following error:
>
> src/font.d:95:15: error: invalid UTF character \U0000FFFF
>
> Any thoughts on why this is happening in GDC, since it works in 
> DMD and LDC2 ?
> And any idea how to fix this ?
>
> Kind regards,
> Danny

What GDC version?

void main()
{
     dchar c = '\u0000';
     while (c <= '\U0000FFFF') {
     }
}

compiles here with gdc (GDC 2.081.2) 8.2.0


More information about the D.gnu mailing list