Re: Are files in dub's "copyFiles" copied every time dub is run?

2018-03-05 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, March 05, 2018 21:26:48 Marc via Digitalmars-d-learn wrote: > if so, can I somehow make it copy only if newest? It actually would have been my guess that it would copy too infrequently - e.g. only on a fresh build - but I don't know. IIRC, it does have that problem when running

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-03-05 20:11:06 +, H. S. Teoh said: Walter has been adamant that we should always compute std.math.* functions with the `real` type, which on x86 maps to the non-IEEE 80-bit floats. However, 80-bit floats have been deprecated for a while now, Hi, do you have a reference for this?

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Kagamin via Digitalmars-d-learn
On Monday, 5 March 2018 at 18:28:43 UTC, Steven Schveighoffer wrote: Note, I think the error is bogus, you should be able to create hard-coded addresses of data at compile time -- I'm not sure how you would do hardware registers otherwise. I'd do them as extern variables, it wouldn't be nice

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread psychoticRabbit via Digitalmars-d-learn
On Monday, 5 March 2018 at 06:01:27 UTC, J-S Caux wrote: So the codes are trivial, simply some check of raw speed: double x = 0.0; for (int a = 0; a < 10; ++a) x += atan(1.0/(1.0 + sqrt(1.0 + a))); for C++ and double x = 0.0; for (int a = 0; a < 1_000_000_000; ++a) x +=

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread jmh530 via Digitalmars-d-learn
On Monday, 5 March 2018 at 21:05:19 UTC, bachmeier wrote: I wonder if Ilya has worked on any of this for Mir. Mir has sin and cos, but that's it. It looks like they use llvm intrinsics on LDC and then fall back to phobos' implementation.

Re: string object won't compile

2018-03-05 Thread askjfbd via Digitalmars-d-learn
On Monday, 5 March 2018 at 23:42:59 UTC, Adam D. Ruppe wrote: On Monday, 5 March 2018 at 23:34:50 UTC, askjfbd wrote: string.d The problem is you named the file string.d and didn't give a `module x;` statement in the code, so the compiler assumed the module is named after the file

Re: string object won't compile

2018-03-05 Thread askjfbd via Digitalmars-d-learn
On Tuesday, 6 March 2018 at 00:18:14 UTC, psychoticRabbit wrote: On Monday, 5 March 2018 at 23:34:50 UTC, askjfbd wrote: Someone please tell me how, for I am a newbie and don't know any solutions even to this very simple problem. As I learned dlang using the Dlang tour page, I stuck at the

Re: string object won't compile

2018-03-05 Thread psychoticRabbit via Digitalmars-d-learn
On Monday, 5 March 2018 at 23:34:50 UTC, askjfbd wrote: Someone please tell me how, for I am a newbie and don't know any solutions even to this very simple problem. As I learned dlang using the Dlang tour page, I stuck at the alias & Strings page. I have tried to compile the following simple

Re: string object won't compile

2018-03-05 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 5 March 2018 at 23:34:50 UTC, askjfbd wrote: string.d The problem is you named the file string.d and didn't give a `module x;` statement in the code, so the compiler assumed the module is named after the file and thus introduced a local name `string` referring to the

Are files in dub's "copyFiles" copied every time dub is run?

2018-03-05 Thread Marc via Digitalmars-d-learn
if so, can I somehow make it copy only if newest?

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread bachmeier via Digitalmars-d-learn
On Monday, 5 March 2018 at 20:11:06 UTC, H. S. Teoh wrote: Walter has been adamant that we should always compute std.math.* functions with the `real` type, which on x86 maps to the non-IEEE 80-bit floats. However, 80-bit floats have been deprecated for a while now, and pretty much nobody

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Mar 05, 2018 at 06:39:21PM +, J-S Caux via Digitalmars-d-learn wrote: [...] > I've tested these two very basic representative codes: > https://www.dropbox.com/s/b5o4i8h43qh1saf/test.cc?dl=0 > https://www.dropbox.com/s/zsaikhdoyun3olk/test.d?dl=0 > > Results: > > C++: > g++ (Apple

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread bauss via Digitalmars-d-learn
On Monday, 5 March 2018 at 18:39:21 UTC, J-S Caux wrote: But now comes the question: can the D fundamental maths functions be propped up to be as fast as the C ones? Probably, if someone takes the time to look at the bottlenecks.

Re: How to use globals correctly?

2018-03-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/5/18 2:25 PM, Marc wrote: Can __gshared be used instead of static in the singleton pattern? I, comming from C++, ignorantly, have never used _gshared so I went to static instead of (being static also means thread-safe, as far I know)... static in D is thread safe, because it's

Re: How to use globals correctly?

2018-03-05 Thread bauss via Digitalmars-d-learn
On Monday, 5 March 2018 at 19:39:35 UTC, Robert M. Münch wrote: On 2018-03-05 18:57:01 +, Steven Schveighoffer said: If you want to have methods, shared kind of sucks. But this at least tells the type system that it's shared between threads. Why does it suck? Because your code will

Re: How to use globals correctly?

2018-03-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/5/18 2:39 PM, Robert M. Münch wrote: On 2018-03-05 18:57:01 +, Steven Schveighoffer said: On 3/5/18 1:35 PM, Robert M. Münch wrote: 1. Are myMemb1..N TLS or __gshared as well? No, they are on the heap. Only the reference is __gshared. But effectively it is __gshared, since you

Re: Fastest way to zero a slice of memory

2018-03-05 Thread kinke via Digitalmars-d-learn
On Sunday, 4 March 2018 at 15:23:41 UTC, Nordlöw wrote: When zeroing a slice of memory (either stack or heap) such as enum n = 100; ubyte[n] chunk; should I use `memset` such as memset(chunk.ptr, 0, n/2); // zero first half or an array assignment such as chunk[0 .. n/2] = 0;

Re: How to use globals correctly?

2018-03-05 Thread Robert M. Münch via Digitalmars-d-learn
On 2018-03-05 18:57:01 +, Steven Schveighoffer said: On 3/5/18 1:35 PM, Robert M. Münch wrote: 1. Are myMemb1..N TLS or __gshared as well? No, they are on the heap. Only the reference is __gshared. But effectively it is __gshared, since you can reach those items via the global

Re: How to use globals correctly?

2018-03-05 Thread Marc via Digitalmars-d-learn
On Monday, 5 March 2018 at 18:57:01 UTC, Steven Schveighoffer wrote: On 3/5/18 1:35 PM, Robert M. Münch wrote: If I use VisualD and add a watch on myObj, I don't see anything just a "identifier myObj is undefined". Not sure if this is because of some threads running (using the D RX

Re: How to use globals correctly?

2018-03-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/5/18 1:35 PM, Robert M. Münch wrote: If I use VisualD and add a watch on myObj, I don't see anything just a "identifier myObj is undefined". Not sure if this is because of some threads running (using the D RX framework). Can't answer your visual D questions... So, some questions: 1.

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread J-S Caux via Digitalmars-d-learn
On Monday, 5 March 2018 at 09:48:49 UTC, Uknown wrote: Depending on your platform, the size of `double` could be different between C++ and D. Could you check that the size and precision are indeed the same? Also, benchmark method is just as important as benchmark code. Did you use DMD or LDC

How to use globals correctly?

2018-03-05 Thread Robert M. Münch via Digitalmars-d-learn
Hi, I'm feeling a bit dumb but anway... For hacking prototypes I mostly create a class to store all kind of values. Then I create one global instance of this class and use it everywhere. Pseudocode looks like this: class myClass { myMemb1; myMembN; this(){...} }

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/5/18 1:08 PM, Stefan Koch wrote: On Monday, 5 March 2018 at 18:04:20 UTC, Nordlöw wrote: On Monday, 5 March 2018 at 16:07:49 UTC, Steven Schveighoffer wrote: No, I mean you call holeKey at *runtime*. Inlined, it's just returning a constant, so it should reduce to a constant. A

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread Johan Engelen via Digitalmars-d-learn
On Monday, 5 March 2018 at 06:01:27 UTC, J-S Caux wrote: On Monday, 5 March 2018 at 05:40:09 UTC, rikki cattermole wrote: On 05/03/2018 6:35 PM, J-S Caux wrote: I'm considering shifting a large existing C++ codebase into D (it's a scientific code making much use of functions like atan, log

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Stefan Koch via Digitalmars-d-learn
On Monday, 5 March 2018 at 18:04:20 UTC, Nordlöw wrote: On Monday, 5 March 2018 at 16:07:49 UTC, Steven Schveighoffer wrote: No, I mean you call holeKey at *runtime*. Inlined, it's just returning a constant, so it should reduce to a constant. A compile-time constant visible to the optimizer?

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Nordlöw via Digitalmars-d-learn
On Monday, 5 March 2018 at 16:07:49 UTC, Steven Schveighoffer wrote: No, I mean you call holeKey at *runtime*. Inlined, it's just returning a constant, so it should reduce to a constant. A compile-time constant visible to the optimizer?

Re: is it possible to put some DDOC after auto generated blocks like unittest examples?

2018-03-05 Thread arturg via Digitalmars-d-learn
On Monday, 5 March 2018 at 14:50:54 UTC, Adam D. Ruppe wrote: No, ddoc does not support that. You might be able to hack it with javascript though. thanks, yeah eigther that or a d script to do some postprocessing, so it can work without javascript.

Re: howto run unittest of a single module in dub driven project?

2018-03-05 Thread Arjan via Digitalmars-d-learn
On Monday, 5 March 2018 at 11:26:37 UTC, Atila Neves wrote: On Sunday, 4 March 2018 at 10:43:06 UTC, Arjan wrote: Is it somehow possible to only run the unittests of a single d file within a dub project? Of course without resorting to typing the complete commandline with all versions includes

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/5/18 9:01 AM, Nordlöw wrote: On Monday, 5 March 2018 at 12:41:06 UTC, Steven Schveighoffer wrote: pragma(inline, true) C lazyDeleted() pure nothrow @trusted { return cast(C)((cast(size_t*)null) + 1); } I still can't evaluate at compile-though...     enum holeKeyOffset = 0x1;

Re: is it possible to put some DDOC after auto generated blocks like unittest examples?

2018-03-05 Thread Adam D. Ruppe via Digitalmars-d-learn
No, ddoc does not support that. You might be able to hack it with javascript though.

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Nordlöw via Digitalmars-d-learn
On Monday, 5 March 2018 at 12:41:06 UTC, Steven Schveighoffer wrote: pragma(inline, true) C lazyDeleted() pure nothrow @trusted { return cast(C)((cast(size_t*)null) + 1); } I still can't evaluate at compile-though... enum holeKeyOffset = 0x1; pragma(inline, true)

Thread Function does not executes

2018-03-05 Thread Vino via Digitalmars-d-learn
Hi All, Request your help, I have 3 functions such as below, I am calling these function using another function ptManage which executes these function's in parallel as each of the below 3 function run's on 10 - 12 different file systems, The issue is as below Issue: Most of the time the

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread Marc via Digitalmars-d-learn
On Monday, 5 March 2018 at 05:35:28 UTC, J-S Caux wrote: I'm considering shifting a large existing C++ codebase into D (it's a scientific code making much use of functions like atan, log etc). I've compared the raw speed of atan between C++ (Apple LLVM version 7.3.0 (clang-703.0.29)) and D

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/5/18 6:41 AM, Nordlöw wrote: On Wednesday, 28 February 2018 at 20:07:50 UTC, Steven Schveighoffer wrote: auto x = cast(Object)((cast(size_t *)null) + 1); Thanks, how do I store it as enum or static immutable struct member? In @trusted pure unittest {     class C { int value; }     C

Re: Validity of cast(void*)size_t.max

2018-03-05 Thread Nordlöw via Digitalmars-d-learn
On Wednesday, 28 February 2018 at 20:07:50 UTC, Steven Schveighoffer wrote: auto x = cast(Object)((cast(size_t *)null) + 1); Thanks, how do I store it as enum or static immutable struct member? In @trusted pure unittest { class C { int value; } C x; C y =

Re: howto run unittest of a single module in dub driven project?

2018-03-05 Thread Atila Neves via Digitalmars-d-learn
On Sunday, 4 March 2018 at 10:43:06 UTC, Arjan wrote: Is it somehow possible to only run the unittests of a single d file within a dub project? Of course without resorting to typing the complete commandline with all versions includes switches etc. You could use unit-threaded:

Re: howto run unittest of a single module in dub driven project?

2018-03-05 Thread Basile B. via Digitalmars-d-learn
On Monday, 5 March 2018 at 09:19:52 UTC, Arjan wrote: On Sunday, 4 March 2018 at 16:51:06 UTC, Basile B. wrote: [1] https://github.com/BBasile/Coedit/commit/f8c5e686c8c6aaa7dc2c770121767e3e59806a0e Thanks for givin me the idea original poster. Guess I will have to give coedit another try

Re: Speed of math function atan: comparison D and C++

2018-03-05 Thread Uknown via Digitalmars-d-learn
On Monday, 5 March 2018 at 06:01:27 UTC, J-S Caux wrote: On Monday, 5 March 2018 at 05:40:09 UTC, rikki cattermole wrote: On 05/03/2018 6:35 PM, J-S Caux wrote: I'm considering shifting a large existing C++ codebase into D (it's a scientific code making much use of functions like atan, log

Re: howto run unittest of a single module in dub driven project?

2018-03-05 Thread Arjan via Digitalmars-d-learn
On Sunday, 4 March 2018 at 16:51:06 UTC, Basile B. wrote: [1] https://github.com/BBasile/Coedit/commit/f8c5e686c8c6aaa7dc2c770121767e3e59806a0e Thanks for givin me the idea original poster. Guess I will have to give coedit another try then.. ;-) So you do use dub behind the scenes so it