On Thursday, November 05, 2015 09:33:39 ixid via Digitalmars-d-learn wrote:
> In C++ I can add two shorts together without having to use a cast
> to assign the result to one of the two shorts. It just seems
> super clunky not to be able to do basic operations on basic types
> without casts everywhe
On Thursday, 5 November 2015 at 18:52:05 UTC, Ali Çehreli wrote:
On 11/05/2015 07:51 AM, Carl Sturtivant wrote:
Hello,
Is cast(T) documented all in one place somewhere? I'd like to
understand
exactly what it does and does not do.
This is what I can find:
http://dlang.org/expression.html
On Friday, 6 November 2015 at 03:59:07 UTC, Charles wrote:
Is it possible to have unittest blocks if I'm compiling a
library?
I've tried having this:
test.d:
class Classy {
unittest { assert(0, "failed test"); }
}
and then build it with `dmd test.d -lib -unittest` and it
do
Is it possible to have unittest blocks if I'm compiling a library?
I've tried having this:
test.d:
class Classy {
unittest { assert(0, "failed test"); }
}
and then build it with `dmd test.d -lib -unittest` and it doesn't
fail the unittest.
On Friday, 6 November 2015 at 01:17:20 UTC, TheFlyingFiddle wrote:
On Friday, 6 November 2015 at 00:43:49 UTC, rsw0x wrote:
On Thursday, 5 November 2015 at 23:37:45 UTC, TheFlyingFiddle
wrote:
On Thursday, 5 November 2015 at 21:24:03 UTC, TheFlyingFiddle
wrote:
[...]
I reduced it further:
[
On Friday, 6 November 2015 at 00:43:49 UTC, rsw0x wrote:
On Thursday, 5 November 2015 at 23:37:45 UTC, TheFlyingFiddle
wrote:
On Thursday, 5 November 2015 at 21:24:03 UTC, TheFlyingFiddle
wrote:
[...]
I reduced it further:
[...]
these run at the exact same speed for me and produce identica
On Thursday, 5 November 2015 at 23:37:45 UTC, TheFlyingFiddle
wrote:
On Thursday, 5 November 2015 at 21:24:03 UTC, TheFlyingFiddle
wrote:
[...]
I reduced it further:
[...]
these run at the exact same speed for me and produce identical
assembly output from a quick glance
dmd 2.069, -O -rel
On Thursday, 5 November 2015 at 21:24:03 UTC, TheFlyingFiddle
wrote:
On Thursday, 5 November 2015 at 21:22:18 UTC, TheFlyingFiddle
wrote:
On Thursday, 5 November 2015 at 11:14:50 UTC, Marc Schütz
wrote:
~10x slowdown...
I forgot to mention this but I am using DMD 2.069.0-rc2 for x86
windows.
On 11/05/2015 12:58 PM, Handyman wrote:
> On Thursday, 5 November 2015 at 20:54:37 UTC, anonymous wrote:
>> There is not attempt to split the `prepare` action up and run parts of
>> it in parallel.
>
> So 1.25 secs is impossible?
For the given example, yes, impossible. However, as mentioned elsew
On Thursday, 5 November 2015 at 22:15:46 UTC, Dominikus Dittes
Scherkl wrote:
On Thursday, 5 November 2015 at 13:23:34 UTC, Adam D. Ruppe
wrote:
On Thursday, 5 November 2015 at 10:07:30 UTC, Dominikus Dittes
Scherkl wrote:
ubyte d = b + (ubyte)1;
Sorry, should of course be:
ubyte d = b + ub
On Thursday, 5 November 2015 at 13:23:34 UTC, Adam D. Ruppe wrote:
On Thursday, 5 November 2015 at 10:07:30 UTC, Dominikus Dittes
Scherkl wrote:
ubyte b = 1u;
auto c = b + 1u;
I expect the 1u to be of type ubyte - and also c.
This won't work because of the one-expression rule. In the
secon
On Thursday, 5 November 2015 at 21:10:16 UTC, anonymous wrote:
parallel(iota(50)))
Wow. I have dealt with ranges and 'iota' (and with parallel), but
I admit I have to think hard about this example. Thanks a bunch
all for your patience.
On Thursday, 5 November 2015 at 20:45:45 UTC, TheGag96 wrote:
Whoa whoa whoa... This is the first time I've heard about this
difference, and I've used .sort plenty of times... That seems
like really, REALLY bad design, especially considering the
language allows functions to be called without pa
On Thursday, 5 November 2015 at 21:22:18 UTC, TheFlyingFiddle
wrote:
On Thursday, 5 November 2015 at 11:14:50 UTC, Marc Schütz wrote:
~10x slowdown...
I forgot to mention this but I am using DMD 2.069.0-rc2 for x86
windows.
On Thursday, 5 November 2015 at 11:14:50 UTC, Marc Schütz wrote:
On Thursday, 5 November 2015 at 03:52:47 UTC, TheFlyingFiddle
wrote:
Can you publish two compilable and runnable versions of the
code that exhibit the difference? Then we can have a look at
the generated assembly. If there's reall
On 05.11.2015 21:52, Handyman wrote:
On Thursday, 5 November 2015 at 20:45:25 UTC, Ali Çehreli wrote:
That's still 1 second per task. The function prepare() cannot be
executed by more than one core.
Thanks. OK. So 'prepare' is atomic? Then let's turn it around: how
can I make the cores prep
On Thursday, 5 November 2015 at 20:54:37 UTC, anonymous wrote:
There is not attempt to split the `prepare` action up and run
parts of it in parallel.
So 1.25 secs is impossible?
On Thursday, 5 November 2015 at 20:45:25 UTC, Ali Çehreli wrote:
That's still 1 second per task. The function prepare() cannot
be executed by more than one core.
Thanks. OK. So 'prepare' is atomic? Then let's turn it around:
how can I make the cores prepare a meal of 5 dishes in 1.25 secs?
On 05.11.2015 21:43, Handyman wrote:
foreach (i; 0..50)
Thread.sleep(20.msecs);
But then my program still says: '2 secs'. Please enlighten me.
Let's look at the line that does the `parallel` call:
foreach (dish; parallel(dishes, 1)) dish.prepare();
This means that `dishes` is proce
On 11/05/2015 12:43 PM, Handyman wrote:
On Thursday, 5 November 2015 at 20:40:00 UTC, anonymous wrote:
So one of your four cores has to make two dishes. That takes two seconds.
So make fine-grained?
foreach (i; 0..50)
Thread.sleep(20.msecs);
But then my program still says: '2 secs'. Pl
On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote:
The second issue is that using .sort instead of .sort() (note
the parentheses) calls the built-in sort instead of
std.algorithm.sort, which is strongly discouraged. You should
always use std.algorithm.sort over the built-in sort, which y
On Thursday, 5 November 2015 at 20:40:00 UTC, anonymous wrote:
So one of your four cores has to make two dishes. That takes
two seconds.
So make fine-grained?
foreach (i; 0..50)
Thread.sleep(20.msecs);
But then my program still says: '2 secs'. Please enlighten me.
On Thursday, 5 November 2015 at 20:30:05 UTC, Handyman wrote:
Seems that 4 cores go all out on first 4 dishes, then 1 core
deals with the last dish. With 4 cores I expect diner is ready
after 5/4 = 1.25 secs though. What did I do wrong?
The first four dishes get scheduled, all of them sleep
On 05.11.2015 21:30, Handyman wrote:
Seems that 4 cores go all out on first 4 dishes, then 1 core deals with
the last dish. With 4 cores I expect diner is ready after 5/4 = 1.25
secs though. What did I do wrong?
You describe the situation correctly. The unit of work is a dish. That
is, the w
import std.stdio;
import core.thread;
import std.datetime; // for stopwatch
import std.parallelism;
void say(string s) { // write and flush
writeln(s);
stdout.flush();
}
struct Dish {
string name;
void prepare() {
say("Start with the " ~ name ~ ".");
Thr
On Thursday, 5 November 2015 at 19:38:23 UTC, Ali Çehreli wrote:
Good one! ;) I'm really happy that he is still around.
Ali
So am I! The more, the merrier!
On 11/05/2015 11:35 AM, Chris wrote:
On Thursday, 5 November 2015 at 19:30:02 UTC, Ali Çehreli wrote:
On 11/05/2015 09:40 AM, bearophile wrote:
Bye,
bearophile
Were you immersed in another language? Rust?
Ali
His D doesn't seem to be Rusty though!
Good one! ;) I'm really happy that he i
On Thursday, 5 November 2015 at 19:30:02 UTC, Ali Çehreli wrote:
On 11/05/2015 09:40 AM, bearophile wrote:
Bye,
bearophile
Were you immersed in another language? Rust?
Ali
His D doesn't seem to be Rusty though!
On 11/05/2015 09:40 AM, bearophile wrote:
Bye,
bearophile
Were you immersed in another language? Rust?
Ali
On 11/05/2015 05:20 AM, ixid wrote:
> This seems very inconsistent, does a += b not lower to a = a + b?
Apparently not:
http://dlang.org/expression.html#AssignExpression
It says "The right operand is implicitly converted to the type of the
left operand". So, the rules are different.
Ali
On 11/05/2015 07:51 AM, Carl Sturtivant wrote:
Hello,
Is cast(T) documented all in one place somewhere? I'd like to understand
exactly what it does and does not do.
This is what I can find:
http://dlang.org/expression.html#CastExpression
Ali
void main() {
import std.stdio, std.algorithm, std.conv, std.bigint,
std.string;
auto n = 17.BigInt ^^ 179;
n.text.dup.representation.sort().release.assumeUTF.writeln;
}
Better:
n.to!(char[]).representation.sort().release.assumeUTF.writeln;
Bye,
bearophile
Namal:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
void main() {
import std.stdio, std.algorithm, std.conv, std.bigint,
std.string;
auto n = 17.BigInt ^^ 179;
n.text.dup.representation.sort().release.assumeUTF.writeln;
}
Bye,
bearophile
On Thursday, 5 November 2015 at 17:13:07 UTC, Ilya Yaroshenko
wrote:
string s1 = to!string(a).dup.sort.idup;
well, but I was just told not to use sort ??
On Thursday, 5 November 2015 at 16:53:50 UTC, Namal wrote:
On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
On Thursday, 5 November 2015 at 16:45:10 UTC, Meta wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_adS
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_adSortChar(dup(to(a
of type char[] to string
what do I
On Thursday, 5 November 2015 at 16:39:03 UTC, Namal wrote:
On Thursday, 5 November 2015 at 16:35:01 UTC, BBasile wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort
On Thursday, 5 November 2015 at 16:35:01 UTC, BBasile wrote:
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_
On Thursday, 5 November 2015 at 16:29:30 UTC, Namal wrote:
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_adSortChar(dup(to(a
of type char[] to string
what do I
Hello I am trying to convert BigInt to string like that while
trying to sort it:
string s1 = to!string(a).dup.sort;
and get an error
cannot implicitly convert expression (_adSortChar(dup(to(a of
type char[] to string
what do I do wrong?
On Monday, 2 November 2015 at 17:07:33 UTC, Laeeth Isharc wrote:
On Sunday, 1 November 2015 at 09:07:56 UTC, Ilya Yaroshenko
wrote:
On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc
wrote:
Any other thoughts?
Floating point operations can be extended automatically
(without some kind
Hello,
Is cast(T) documented all in one place somewhere? I'd like to
understand exactly what it does and does not do.
On Thursday, 5 November 2015 at 07:26:08 UTC, drug wrote:
It seems to me I saw somewhere the project like this. I don't
want to make another one if there is something like that.
Where you thinking of Derelict?
https://github.com/DerelictOrg/DerelictSDL2
or perhaps Dgame:
https://github.com/D
On Thursday, 5 November 2015 at 03:52:47 UTC, TheFlyingFiddle
wrote:
[...]
I solved the problem by changing the struct to look like this.
align(16) struct Pos
{
float x = float.nan;
float y = float.nan;
float z = float.nan;
float w = float.nan;
}
wow that's quite strange. FP me
This may have been overlooked in my other thread so I wanted to
ask again:
This seems very inconsistent, does a += b not lower to a = a + b?
I guess not based on the below:
ushort a = ushort.max, b = ushort.max;
a += b; // Compiles fine
a = a + b; // Error: cannot implicitly con
On Thursday, 5 November 2015 at 10:07:30 UTC, Dominikus Dittes
Scherkl wrote:
And I want to have small number litterals automatically
choosing the smallest fitting type.
It does, that's the value range propagation at work. Inside one
expression, if the compiler can prove it fits in a smaller t
On Thursday, 5 November 2015 at 10:04:02 UTC, Andrea Fontana
wrote:
Anyway: are duplicated keys on declaration allowed?
They shouldn't be...
On Tuesday, 3 November 2015 at 23:16:59 UTC, bertg wrote:
I am having trouble with a simple use of concurrency.
Running the following code I get 3 different tid's, multiple
"sock in" messages printed, but no receives. I am supposed to
get a "received!" for each "sock in", but I am getting hung
On Thursday, 5 November 2015 at 03:52:47 UTC, TheFlyingFiddle
wrote:
I don't really know where to go from here to figure out the
underlying cause. Does anyone have any suggestions?
Can you publish two compilable and runnable versions of the code
that exhibit the difference? Then we can have a
https://issues.dlang.org/show_bug.cgi?id=15290
On Thursday, 5 November 2015 at 08:55:10 UTC, Andrea Fontana
wrote:
Check this:
http://dpaste.dzfl.pl/ebbb3ebac60e
It doesn't give any error or warning. And writeln seems
confused (do you see that "," at the end?)
This is an outright bug, please report on issues.dlang.org:
void main()
{
On Thursday, 5 November 2015 at 10:04:02 UTC, Andrea Fontana
wrote:
Anyway: are duplicated keys on declaration allowed?
IMHO This should at least be a warning.
And I want to have small number litterals automatically choosing
the smallest fitting type.
If I write
ubyte b = 1u;
auto c = b + 1u;
I expect the 1u to be of type ubyte - and also c.
On Thursday, 5 November 2015 at 09:27:35 UTC, tcak wrote:
On Thursday, 5 November 2015 at 08:55:10 UTC, Andrea Fontana
wrote:
Check this:
http://dpaste.dzfl.pl/ebbb3ebac60e
It doesn't give any error or warning. And writeln seems
confused (do you see that "," at the end?)
I am sure the coder
On Thursday, 5 November 2015 at 09:33:40 UTC, ixid wrote:
In C++ I can add two shorts together without having to use a
cast to assign the result to one of the two shorts. It just
seems super clunky not to be able to do basic operations on
basic types without casts everywhere.
+1
If automatic
On Thursday, 5 November 2015 at 05:41:46 UTC, Jonathan M Davis
wrote:
On Wednesday, November 04, 2015 21:22:02 ixid via
Digitalmars-d-learn wrote:
On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin
wrote:
> On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
>> Is there an elegan
On Thursday, 5 November 2015 at 08:55:10 UTC, Andrea Fontana
wrote:
Check this:
http://dpaste.dzfl.pl/ebbb3ebac60e
It doesn't give any error or warning. And writeln seems
confused (do you see that "," at the end?)
I am sure the coder of writeln was lazy to prevent putting ", "
after last ite
Check this:
http://dpaste.dzfl.pl/ebbb3ebac60e
It doesn't give any error or warning. And writeln seems confused
(do you see that "," at the end?)
59 matches
Mail list logo