Error: unsupported char 0x03

Adam D. Ruppe destructionator at gmail.com
Tue Oct 22 08:05:15 PDT 2013


On Tuesday, 22 October 2013 at 15:01:20 UTC, Agustin wrote:
>         = "public immutable(int) getId() const { \n" ~ id ~ "; 
> \n}";

You'll probably want to convert id to a string there

import std.conv;

  "public immutable(int) getId() const { \n" ~ to!string(id) ~ ";

and also put in return for that function:
  "public immutable(int) getId() const { \n return " ~ 
to!string(id) ~ ";


and it should compile. What was happening before is string ~ int 
implicitly converts the int to a char, and cast(char)(3) isn't a 
printable character, and isn't allowed in D source code.


More information about the Digitalmars-d-learn mailing list