www.digitalmars.com         C & C++   DMDScript  

D.gnu - Iteration on UTF/UNICODE characters

reply Danny Arends <Danny.Arends gmail.com> writes:
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)){

   }
}

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
Sep 11 2018
parent reply Eugene Wissner <belka caraus.de> writes:
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)){

   }
 }

 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
Sep 11 2018
parent reply Danny Arends <Danny.Arends gmail.com> writes:
On Tuesday, 11 September 2018 at 09:32:51 UTC, Eugene Wissner 
wrote:
 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)){

   }
 }

 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
I am using the GDC2 compiler from the Ubuntu Repository (I guess this is a really old version of gdc) gdc --version gdc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609 Guess I will have to manually install the latest version, I was hoping to be able to use the version in the Ubuntu packages, to have the requirements for the program be: apt install gdc I will try to use the newest version, see if it can compile the code Thanks, Danny
Sep 11 2018
parent Iain Buclaw <ibuclaw gdcproject.org> writes:
On 11 September 2018 at 12:17, Danny Arends via D.gnu
<d.gnu puremagic.com> wrote:
 On Tuesday, 11 September 2018 at 09:32:51 UTC, Eugene Wissner wrote:
 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)){

   }
 }

 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
I am using the GDC2 compiler from the Ubuntu Repository (I guess this is a really old version of gdc) gdc --version gdc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609 Guess I will have to manually install the latest version, I was hoping to be able to use the version in the Ubuntu packages, to have the requirements for the program be: apt install gdc I will try to use the newest version, see if it can compile the code
gcc-5 is nearly 4 years old! You'd probably have better luck switching to the current LTS release of Ubuntu, which installs gcc-7 by default, which is a reasonable version to start from.
Sep 11 2018