Dpaste vs dmd 2.063.2 errors
monarch_dodra
monarchdodra at gmail.com
Tue Jul 23 05:59:08 PDT 2013
On Tuesday, 23 July 2013 at 12:26:31 UTC, JS wrote:
> http://dpaste.dzfl.pl/27ca3fbd
>
> The code compiles fine on my computer. On DPaste there is all
> kinds of errors(when fixing one other errors pop up.
>
> I am compiling to 32-bit binary and that is the only real
> difference I can see, but surely it wouldn't result in such
> errors?
>
> The first error:
>
> /d547/f451.d(227): Error: unterminated character constant
> /d547/f451.d(227): Error: unterminated character constant
> /d547/f451.d(227): Error: found '41U' when expecting ')'
>
> makes no sense as far as I can tell unless my expand code
> generation templates are messed up.
>
> If someone wouldn't mind trying to compile the code and see if
> the errors are similar to dpaste I'd appreciate it. (I don't
> want to end up writing code that is very bad(even though this
> is just proof of concept code) and will end up breaking)
I'm getting some compile errors, because you are trying to cram a
size_t into a int:
hello.d(179): Error: cannot implicitly convert expression
(s.length - 1LU) of type ulong to int
if (s[max(0, j - d[0].length + 1)..s.length] == d[0]) { maxL =
max(maxL, d[0].length); }
if (s[max(0, j - d[1].length + 1)..s.length] == d[1]) { maxL =
max(maxL, d[1].length); }
if (s[max(0, j - d[2].length + 1)..s.length] == d[2]) { maxL =
max(maxL, d[2].length); }
hello.d(182): Error: cannot implicitly convert expression
(max(maxL, _param_1.length)) of type ulong to int
hello.d(183): Error: cannot implicitly convert expression
(max(maxL, _param_2.length)) of type ulong to int
hello.d(184): Error: cannot implicitly convert expression
(max(maxL, _param_3.length)) of type ulong to int
hello.d(192): Error: template instance hello.stripRight!(string,
string, string) error instantiating
hello.d(237): instantiated from here: strip!(string,
string, string)
if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL =
max(maxL, d[0].length); }
if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL =
max(maxL, d[1].length); }
if (s[j..min(s.length, j + d[2].length)] == d[2]) { maxL =
max(maxL, d[2].length); }
hello.d(166): Error: cannot implicitly convert expression
(max(maxL, _param_1.length)) of type ulong to int
hello.d(167): Error: cannot implicitly convert expression
(max(maxL, _param_2.length)) of type ulong to int
hello.d(168): Error: cannot implicitly convert expression
(max(maxL, _param_3.length)) of type ulong to int
hello.d(192): Error: template instance hello.stripLeft!(string,
string, string) error instantiating
hello.d(237): instantiated from here: strip!(string,
string, string)
hello.d(237): Error: template instance hello.strip!(string,
string, string) error instantiating
if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL =
max(maxL, d[0].length); }
if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL =
max(maxL, d[1].length); }
hello.d(128): Error: cannot implicitly convert expression
(max(maxL, _param_1.length)) of type ulong to int
hello.d(129): Error: cannot implicitly convert expression
(max(maxL, _param_2.length)) of type ulong to int
hello.d(238): Error: template instance hello.split!(string,
string) error instantiating
hello.d(179): Error: cannot implicitly convert expression
(s.length - 1LU) of type ulong to int
if (s[j] == d[0]) { maxL = max(maxL, 1); }
hello.d(175): Error: template instance hello.stripRight!(char)
error instantiating
hello.d(239): instantiated from here: stripRight!()
hello.d(239): Error: template instance hello.stripRight!() error
instantiating
if (s[j..min(s.length, j + d[0].length)] == d[0]) { return j; }
if (s[j..min(s.length, j + d[1].length)] == d[1]) { return j; }
Once you change those, the program compiles (on my machine
anyways).
Running it produces strange output though:
Compilation:
if (s[max(0, j - d[0].length + 1)..s.length] == d[0]) { maxL =
max(maxL, d[0].length); }
if (s[max(0, j - d[1].length + 1)..s.length] == d[1]) { maxL =
max(maxL, d[1].length); }
if (s[max(0, j - d[2].length + 1)..s.length] == d[2]) { maxL =
max(maxL, d[2].length); }
if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL =
max(maxL, d[0].length); }
if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL =
max(maxL, d[1].length); }
if (s[j..min(s.length, j + d[2].length)] == d[2]) { maxL =
max(maxL, d[2].length); }
if (s[j..min(s.length, j + d[0].length)] == d[0]) { maxL =
max(maxL, d[0].length); }
if (s[j..min(s.length, j + d[1].length)] == d[1]) { maxL =
max(maxL, d[1].length); }
if (s[j] == d[0]) { maxL = max(maxL, 1); }
if (s[j..min(s.length, j + d[0].length)] == d[0]) { return j; }
if (s[j..min(s.length, j + d[1].length)] == d[1]) { return j; }
Run:
acdb99:{9acdb99
db99:{9acdb9
acdb99
9acdb99
aaaaa
a
b
c
More information about the Digitalmars-d-learn
mailing list