Battle-plan for CTFE
Stefam Koch via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Oct 25 20:58:05 PDT 2016
On Tuesday, 25 October 2016 at 17:19:26 UTC, Jacob Carlborg wrote:
>
> Very impressive :)
Thanks.
I just got the following code to compile and execute correctly.
bool strEq(string a, string b)
{
if (a.length != b.length)
{
return false;
}
uint length = cast(uint) a.length;
while(length--)
{
auto c1 = a[length];
auto c2 = b[length];
if (c1 != c2)
{
return false;
}
}
return true;
}
static assert(!strEq("Hello","World"));
static assert(strEq("World","World"));
I used the generated bytecode to make == for strings work.
More information about the Digitalmars-d-announce
mailing list