On Wednesday, 17 September 2014 at 13:03:05 UTC, flamencofantasy
wrote:
the result of ubyte + ubyte is int I believe.
Try;
void func( int c )
{
ubyte a;
a = cast(ubyte)(cast(ubyte)c + cast(ubyte)c);
}
From http://dlang.org/type, under Usual Arithmetic Conversions:
4. Else the intege
void func( int c )
{
ubyte a;
a = cast(ubyte)c + cast(ubyte)c;
}
dmd v2.065 complains about:
test.d(5): Error: cannot implicitly convert expression
(cast(int)cast(ubyte)c + cast(int)cast(ubyte)c) of type int to
ubyte
As far as I can tell, adding two values of the same type should
re
The following program compiles, and does what you'd expect:
struct A {
int a;
}
pure int func( ref A a )
{
return a.a += 3;
}
As far as I can tell, however, it shouldn't. I don't see how or
why func can possibly be considered pure, as it changes a state
external to the function.
Wha
On Thursday, 21 August 2014 at 06:11:06 UTC, ketmar via
Digitalmars-d-learn wrote:
that will do the trick.
Indeed. I ended up simply directly calling
"a.opDispatch!"do_something_cool"(5, 6)", which brought most of
those issues to light.
Shachar
I'm trying to compile the onDispatch demo program from "The D
Programming Language" (page 387). At first I had an import
problem, but I fixed that. Now, however, when I try to call
"a.do_something_cool", I get an error message saying:
onDispatch.d(43): Error: no property 'do_something_cool' fo