Re: [OT] compiler optimisations

2015-04-24 Thread deadalnix via Digitalmars-d
On Thursday, 23 April 2015 at 10:23:57 UTC, Andrea Fontana wrote: On Thursday, 23 April 2015 at 10:08:24 UTC, John Colvin wrote: asm.dlang.org and d.godbolt.org This isn't a D-specific question though, so gcc.godbolt.org would allow you to test a wider range of backends. I was wondering

Re: Cleaned up C++

2015-04-24 Thread Daniel Murphy via Digitalmars-d
Walter Bright wrote in message news:mhc7am$942$1...@digitalmars.com... Everyone hated it :-) but me. And by that Walter means the interface was highly unsafe and he didn't want to change it.

Re: Coding for solid state drives

2015-04-24 Thread tcak via Digitalmars-d
On Friday, 24 April 2015 at 08:27:06 UTC, Walter Bright wrote: http://codecapsule.com/2014/02/12/coding-for-ssds-part-6-a-summary-what-every-programmer-should-know-about-solid-state-drives/ An interesting article. Anyone want to see if there are any modifications we should make to std.stdio to

Re: Performance of map!()

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 10:53:04 UTC, John Colvin wrote: On Friday, 24 April 2015 at 10:22:05 UTC, Chris wrote: I replaced a range that was similar to map with map and the performance dropped by ~0.5 msec. The range I used previously is based on Adam's D Cookbook. It is consistently

Performance of loops

2015-04-24 Thread Chris via Digitalmars-d
I tested the performance of three types of loops (see code below). It turns out that the fastest loop is the plainLoop. Unless my examples are completely screwed up, the difference between plainLoop and the other two loops is gigantic (e.g.): 9 ms, 149 μs, and 4 hnsecs // foreach (const ref

Re: Performance of loops

2015-04-24 Thread John Colvin via Digitalmars-d
On Friday, 24 April 2015 at 11:00:23 UTC, Chris wrote: I tested the performance of three types of loops (see code below). It turns out that the fastest loop is the plainLoop. Unless my examples are completely screwed up, the difference between plainLoop and the other two loops is gigantic

Re: Performance of map!()

2015-04-24 Thread via Digitalmars-d
dmd v2.067.0 dub --build=release (-release -inline -O -boundscheck=off) Does a benchmark of dmd generated code really matter?

Re: Performance of map!()

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 11:33:48 UTC, John Colvin wrote: On Friday, 24 April 2015 at 10:22:05 UTC, Chris wrote: I replaced a range that was similar to map with map and the performance dropped by ~0.5 msec. The range I used previously is based on Adam's D Cookbook. It is consistently

Re: WTF: dmd 2.066 vs. dmd 2.067 really dangerous code breakage

2015-04-24 Thread Iain Buclaw via Digitalmars-d
On 24 April 2015 at 09:22, Martin Nowak via Digitalmars-d digitalmars-d@puremagic.com wrote: On Friday, 24 April 2015 at 02:09:06 UTC, Walter Bright wrote: On 4/23/2015 6:26 AM, Steven Schveighoffer wrote: I agree it should have been done, not saying it's OK to break the process in some

[Issue 14492] Deprecate scope for allocating classes on the stack

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14492 Jonathan M Davis issues.dl...@jmdavisprog.com changed: What|Removed |Added CC|

Re: [OT] compiler optimisations

2015-04-24 Thread Andrea Fontana via Digitalmars-d
On Friday, 24 April 2015 at 06:29:55 UTC, deadalnix wrote: On Thursday, 23 April 2015 at 10:23:57 UTC, Andrea Fontana wrote: On Thursday, 23 April 2015 at 10:08:24 UTC, John Colvin wrote: asm.dlang.org and d.godbolt.org This isn't a D-specific question though, so gcc.godbolt.org would

Re: code.dlang community transfer repository

2015-04-24 Thread extrawurst via Digitalmars-d
On Friday, 24 April 2015 at 08:05:18 UTC, wobbles wrote: On Thursday, 23 April 2015 at 15:43:43 UTC, Jesse Phillips wrote: Dub provides an easy way to utilizes 3rd party libraries, github provides an easy way to revive a project no longer being maintained by the author. Can we come up with a

Re: AA Performance in Benchmarks

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 09:18:48 UTC, Chris wrote: On Thursday, 23 April 2015 at 14:40:58 UTC, Shammah Chancellor wrote: So, I was tooling around with one of the benchmarks I saw listed on twitter: https://github.com/kostya/benchmarks/tree/master/brainfuck This D benchmark spends most of

Re: AA Performance in Benchmarks

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 11:30:14 UTC, Chris wrote: On Friday, 24 April 2015 at 09:18:48 UTC, Chris wrote: On Thursday, 23 April 2015 at 14:40:58 UTC, Shammah Chancellor wrote: So, I was tooling around with one of the benchmarks I saw listed on twitter:

Re: Performance of map!()

2015-04-24 Thread John Colvin via Digitalmars-d
On Friday, 24 April 2015 at 10:22:05 UTC, Chris wrote: I replaced a range that was similar to map with map and the performance dropped by ~0.5 msec. The range I used previously is based on Adam's D Cookbook. It is consistently faster than map. private struct Transformer(alias agent, R) if

Re: Performance of map!()

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 11:38:46 UTC, Casper Færgemand wrote: dmd v2.067.0 dub --build=release (-release -inline -O -boundscheck=off) Does a benchmark of dmd generated code really matter? At least for dmd.

[Issue 12666] @nogc std.array.front, popFront, and more

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=12666 ag0ae...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution|---

Re: [OT] compiler optimisations

2015-04-24 Thread John Colvin via Digitalmars-d
On Friday, 24 April 2015 at 06:29:55 UTC, deadalnix wrote: On Thursday, 23 April 2015 at 10:23:57 UTC, Andrea Fontana wrote: On Thursday, 23 April 2015 at 10:08:24 UTC, John Colvin wrote: asm.dlang.org and d.godbolt.org This isn't a D-specific question though, so gcc.godbolt.org would

Re: Download DDMD?

2015-04-24 Thread Joakim via Digitalmars-d-learn
On Wednesday, 22 April 2015 at 07:57:40 UTC, Jeremiah DeHaan wrote: Just curious, but I was wondering if there was a 2.067 DDMD available for download somewhere for Windows. If not, then are there any special build instructions I need to build it? I kind of just want to try a couple of things,

Re: code.dlang community transfer repository

2015-04-24 Thread wobbles via Digitalmars-d
On Thursday, 23 April 2015 at 15:43:43 UTC, Jesse Phillips wrote: Dub provides an easy way to utilizes 3rd party libraries, github provides an easy way to revive a project no longer being maintained by the author. Can we come up with a solution within code.dlang to take advantage of this?

[Issue 14492] New: Deprecate scope for allocating classes on the stack

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14492 Issue ID: 14492 Summary: Deprecate scope for allocating classes on the stack Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

[Issue 14491] New: Deprecate overriding without override

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14491 Issue ID: 14491 Summary: Deprecate overriding without override Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Chris via Digitalmars-d-learn
On Thursday, 23 April 2015 at 22:26:28 UTC, Jens Bauer wrote: On Thursday, 23 April 2015 at 19:24:31 UTC, Chris wrote: On Thursday, 23 April 2015 at 16:57:30 UTC, Jens Bauer wrote: 3: Audio mixing and playback (eg. a MOD player for instance). 5: Queueing up a bunch of different jobs; At the

Re: AA Performance in Benchmarks

2015-04-24 Thread Chris via Digitalmars-d
On Thursday, 23 April 2015 at 14:40:58 UTC, Shammah Chancellor wrote: So, I was tooling around with one of the benchmarks I saw listed on twitter: https://github.com/kostya/benchmarks/tree/master/brainfuck This D benchmark spends most of it's time on AA lookups. Discussions about the

[Issue 14491] Deprecate overriding without override

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14491 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||yebbl...@gmail.com --- Comment

Re: Coding for solid state drives

2015-04-24 Thread Kagamin via Digitalmars-d
Shouldn't system cache apply appropriate sync policy?

Re: Cleaned up C++

2015-04-24 Thread Walter Bright via Digitalmars-d
On 4/24/2015 12:23 AM, John Colvin wrote: Except of course that alloca is a lot cheaper than malloc/free. That's not necessarily true. But in any case, go ahead and use it if you like. Just prepare to benchmark and be disappointed :-)

Re: Performance of map!()

2015-04-24 Thread via Digitalmars-d
On Friday, 24 April 2015 at 11:49:24 UTC, Chris wrote: On Friday, 24 April 2015 at 11:38:46 UTC, Casper Færgemand wrote: dmd v2.067.0 dub --build=release (-release -inline -O -boundscheck=off) Does a benchmark of dmd generated code really matter? At least for dmd. dmd is good at making

Re: Performance of loops

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 11:39:14 UTC, John Colvin wrote: On Friday, 24 April 2015 at 11:00:23 UTC, Chris wrote: I tested the performance of three types of loops (see code below). It turns out that the fastest loop is the plainLoop. Unless my examples are completely screwed up, the

[Issue 14490] New: Deprecate .sort and .reverse properties for arrays

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14490 Issue ID: 14490 Summary: Deprecate .sort and .reverse properties for arrays Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

Performance of map!()

2015-04-24 Thread Chris via Digitalmars-d
I replaced a range that was similar to map with map and the performance dropped by ~0.5 msec. The range I used previously is based on Adam's D Cookbook. It is consistently faster than map. private struct Transformer(alias agent, R) if (isInputRange!R) { private R r; this (R r) {

Coding for solid state drives

2015-04-24 Thread Walter Bright via Digitalmars-d
http://codecapsule.com/2014/02/12/coding-for-ssds-part-6-a-summary-what-every-programmer-should-know-about-solid-state-drives/ An interesting article. Anyone want to see if there are any modifications we should make to std.stdio to work better with SSDs? (Such as changing the buffer sizes.)

Re: Coding for solid state drives

2015-04-24 Thread weaselcat via Digitalmars-d
On Friday, 24 April 2015 at 08:27:06 UTC, Walter Bright wrote: http://codecapsule.com/2014/02/12/coding-for-ssds-part-6-a-summary-what-every-programmer-should-know-about-solid-state-drives/ An interesting article. Anyone want to see if there are any modifications we should make to std.stdio to

Re: Trial migration of Dsource bindings project to Github

2015-04-24 Thread Kagamin via Digitalmars-d-announce
On Tuesday, 21 April 2015 at 21:31:39 UTC, Stewart Gordon wrote: How does using SVN lead to fragmentation? I don't understand. See http://forum.dlang.org/post/mailman.3160.1418550079.9932.digitalmar...@puremagic.com

Re: Performance of loops

2015-04-24 Thread via Digitalmars-d
Most of the time is taken up by the array's allocation. The optimizers of both DMD and LDC evidently doesn't optimize it away when you use `ref`, even though it could in theory. Remove the `enum` and just use a normal global variable, and you will get more or less identical times for all

Re: Performance of map!()

2015-04-24 Thread via Digitalmars-d
On Friday, 24 April 2015 at 11:33:48 UTC, John Colvin wrote: That is pretty much identical to the implementation of map, see https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm/iteration.d#L504 The only difference is that you don't implement opSlice. Perhaps slicing is

[Issue 14488] New: Deprecate Imaginary and complex types

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14488 Issue ID: 14488 Summary: Deprecate Imaginary and complex types Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

[Issue 14489] New: Deprecate Floating point NCEG operators

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14489 Issue ID: 14489 Summary: Deprecate Floating point NCEG operators Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

[Issue 14492] Deprecate scope for allocating classes on the stack

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14492 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment

Re: Performance of map!()

2015-04-24 Thread John Colvin via Digitalmars-d
On Friday, 24 April 2015 at 10:22:05 UTC, Chris wrote: I replaced a range that was similar to map with map and the performance dropped by ~0.5 msec. The range I used previously is based on Adam's D Cookbook. It is consistently faster than map. private struct Transformer(alias agent, R) if

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 07:34:55 UTC, tom wrote: would something like a STM32 NUCLEO-F401RE work? I forgot to give you a proper answer on this one: I think it should work, as it's a STM32F401 microcontroller. -So basically you get a 'bare metal' setup with no drivers. However, as you

Re: function ref param vs pointer param

2015-04-24 Thread bearophile via Digitalmars-d-learn
On Friday, 24 April 2015 at 13:39:35 UTC, ref2401 wrote: processPointer(ms); I think doing this way is more descriptive. Now all readers know that ms might be changed inside the function. C# avoids that problem requiring (in most cases) the usage of ref at the calling point too. But this

Re: Cleaned up C++

2015-04-24 Thread ponce via Digitalmars-d
On Friday, 24 April 2015 at 08:16:40 UTC, Walter Bright wrote: On 4/24/2015 12:23 AM, John Colvin wrote: Except of course that alloca is a lot cheaper than malloc/free. That's not necessarily true. But in any case, go ahead and use it if you like. Just prepare to benchmark and be

[Issue 14492] Deprecate scope for allocating classes on the stack

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14492 yebblies yebbl...@gmail.com changed: What|Removed |Added CC||yebbl...@gmail.com --- Comment

Re: Startup files for STM32F4xx

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/23/15 11:30 AM, Jens Bauer wrote: On Thursday, 23 April 2015 at 12:14:59 UTC, Steven Schveighoffer wrote: You can't use something like this? http://www.floodgap.com/software/tenfourfox/ Wow, I thought they stopped making builds at v20! -I'm pretty sure they said on the Web-site that

Re: Performance of loops

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 11:53:56 UTC, Marc Schütz wrote: Most of the time is taken up by the array's allocation. The optimizers of both DMD and LDC evidently doesn't optimize it away when you use `ref`, even though it could in theory. Remove the `enum` and just use a normal global

function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
What advantages do ref params give over pointer params? struct MyStruct { string str; this(string str) { this.str = str; } } void processRef(ref MyStruct ms) { writeln(processRef: , ms); } void processPointer(MyStruct* ms) { writeln(processPointer: , *ms); }

Re: function ref param vs pointer param

2015-04-24 Thread Ali Çehreli via Digitalmars-d-learn
On 04/24/2015 06:23 AM, ref2401 wrote: What advantages do ref params give over pointer params? Another difference is that a ref parameter is not null and what is referred to is not an rvalue. However, it is possible to break that expectation if a pointer is dereferenced and passed to a

Re: function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
Thank you

[Issue 14385] AA should use open addressing hash

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14385 --- Comment #3 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/79bc91b41334c1805f557ef2f1606de31c6764d1 fix Issue 14385 -

[Issue 14493] New: std.range.walkBack too

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14493 Issue ID: 14493 Summary: std.range.walkBack too Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1

[Issue 14494] New: Improve std.array.replicate documentation

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14494 Issue ID: 14494 Summary: Improve std.array.replicate documentation Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement

Re: Performance of loops

2015-04-24 Thread Baz via Digitalmars-d
On Friday, 24 April 2015 at 11:00:23 UTC, Chris wrote: I tested the performance of three types of loops (see code below). It turns out that the fastest loop is the plainLoop. Unless my examples are completely screwed up, the difference between plainLoop and the other two loops is gigantic

Re: function ref param vs pointer param

2015-04-24 Thread bearophile via Digitalmars-d-learn
ref2401: void processRef(ref MyStruct ms) { writeln(processRef: , ms); } void processPointer(MyStruct* ms) { writeln(processPointer: , *ms); ref params don't need the * every time you use them inside the function, and don't need the when you call the function. Bye,

[Issue 14492] Deprecate scope for allocating classes on the stack

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14492 --- Comment #4 from Jonathan M Davis issues.dl...@jmdavisprog.com --- (In reply to yebblies from comment #3) As Jonathan said, it's used in DDMD. What we really need is a way to make it @safe, not deprecating it. Why aren't you using

[Issue 14480] dmd 2.067 x64 release codegen

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14480 --- Comment #6 from fen...@gmail.com --- Here's a reduced test case // compile on windows with dmd -m64 -O test.d = BAD import std.stdio; import std.array; import std.math; import std.algorithm; import std.range; struct Vector(T, alias N) {

Re: Performance of loops

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d
On 4/24/15 9:13 AM, Chris wrote: On Friday, 24 April 2015 at 11:53:56 UTC, Marc Schütz wrote: Most of the time is taken up by the array's allocation. The optimizers of both DMD and LDC evidently doesn't optimize it away when you use `ref`, even though it could in theory. Remove the `enum` and

Re: function ref param vs pointer param

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 9:23 AM, ref2401 wrote: What advantages do ref params give over pointer params? struct MyStruct { string str; this(string str) { this.str = str; } } void processRef(ref MyStruct ms) { writeln(processRef: , ms); } void processPointer(MyStruct* ms) {

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 09:15:21 UTC, Chris wrote: I was more thinking of the audio thread. But the audio is probably better off in a separate thread. I think you could do this too. In fact, this is very similar to how the audio from a MOD file is decoded. (I only mentioned an

Re: Startup files for STM32F4xx

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 07:34:55 UTC, tom wrote: On Thursday, 23 April 2015 at 15:30:18 UTC, Jens Bauer wrote: The most important thing, though, is that D-programmers now have a starting point for the STM32F4xx. It should be easy to adapt the same sources to other MCUs. I'm planning on

Re: Cleaned up C++

2015-04-24 Thread John Colvin via Digitalmars-d
On Friday, 24 April 2015 at 12:34:19 UTC, ponce wrote: On Friday, 24 April 2015 at 08:16:40 UTC, Walter Bright wrote: On 4/24/2015 12:23 AM, John Colvin wrote: Except of course that alloca is a lot cheaper than malloc/free. That's not necessarily true. But in any case, go ahead and use it

Re: function ref param vs pointer param

2015-04-24 Thread ref2401 via Digitalmars-d-learn
processPointer(ms); I think doing this way is more descriptive. Now all readers know that ms might be changed inside the function.

Re: Performance of loops

2015-04-24 Thread Chris via Digitalmars-d
On Friday, 24 April 2015 at 13:55:49 UTC, Steven Schveighoffer wrote: On 4/24/15 9:13 AM, Chris wrote: On Friday, 24 April 2015 at 11:53:56 UTC, Marc Schütz wrote: Most of the time is taken up by the array's allocation. The optimizers of both DMD and LDC evidently doesn't optimize it away when

Re: Vectorization examples

2015-04-24 Thread Luc Bourhis via Digitalmars-d
On Monday, 20 April 2015 at 11:15:48 UTC, finalpatch wrote: On Monday, 20 April 2015 at 11:01:28 UTC, Panke wrote: Aren't unaligned loads as fast as aligned loads on modern x86? No that's not true. On modern x86 processors using unaligned loading instructions on aligned data does not incur

Re: No line numbers in compiler error messages

2015-04-24 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:20:12 UTC, John Nixon wrote: I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line do this? BTW I only found out about D a couple

Re: Convert hex to binary

2015-04-24 Thread Ali Çehreli via Digitalmars-d-learn
On 04/24/2015 11:14 AM, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = 123456789ABCDEF myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks for suggestions!

Re: code.dlang community transfer repository

2015-04-24 Thread Martin Nowak via Digitalmars-d
On 04/24/2015 12:08 PM, extrawurst wrote: let's just use the github stars system. i guess the github API allows us to query those too. maybe we can even star a project from the registry too ?! Interesting idea, but github centric. We already have download numbers and would just need to cache

Degenerate Regex Case

2015-04-24 Thread Guillaume via Digitalmars-d-learn
Hello, I'm trying to make a regex comparison with D, based off of this article: https://swtch.com/~rsc/regexp/regexp1.html I've written my code like so: import std.stdio, std.regex; void main(string argv[]) { string m = argv[1]; auto p =

Re: A valid code that won't run?

2015-04-24 Thread cym13 via Digitalmars-d
On Friday, 24 April 2015 at 18:10:47 UTC, Ali Çehreli wrote: On 04/24/2015 10:26 AM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net wrote: You need to link against libcurl explicitly, it doesn't happen automatically: dmd -L-lcurl test.d Another option is to add it to the source:

Weird OSX issue

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
OK, so I think I found a bug, but I have no idea how to reproduce it. It seems to be dependent on environment. Here is an annotated (using # for comments) session to show you the weirdness. All versions are 2.067, and I did use dmd -v to make sure rogue dmd.conf or library files are not

Range of chars (narrow string ranges)

2015-04-24 Thread Martin Nowak via Digitalmars-d
Just want to make this a bit more visible. https://github.com/D-Programming-Language/phobos/pull/3206#issuecomment-95681812 We just added entabber to std.phobos, and AFAIK, it's the first range algorithm that transforms narrow strings to a range of chars, instead of decoding the original string

Re: __gshared static

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 1:22 PM, =?UTF-8?B?Ik3DoXJjaW8=?= Martins\ marcio...@gmail.com\ wrote: Hi! I just stumbled across what seems like a misunderstanding on my side about these keywords. Can someone help clarify these for me? ``` __gshared static int foo; __gshared int foo; ``` What are the storage and

Convert hex to binary

2015-04-24 Thread nrgyzer via Digitalmars-d-learn
Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = 123456789ABCDEF myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks for suggestions!

Re: A valid code that won't run?

2015-04-24 Thread Ali Çehreli via Digitalmars-d
On 04/24/2015 10:26 AM, Marc =?UTF-8?B?U2Now7x0eiI=?= schue...@gmx.net wrote: You need to link against libcurl explicitly, it doesn't happen automatically: dmd -L-lcurl test.d Another option is to add it to the source: pragma(lib, curl); Then it finds the library on the system and

Re: No line numbers in compiler error messages

2015-04-24 Thread John Nixon via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:45:49 UTC, Steven Schveighoffer wrote: On 4/24/15 1:20 PM, John Nixon wrote: I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line

Re: GC.malloc is pure - wat

2015-04-24 Thread anonymous via Digitalmars-d
On Friday, 24 April 2015 at 18:03:50 UTC, David Nadlinger wrote: In case there is further confusion about purity in D, let me do a shameless plug for an article I wrote a couple of years back: http://klickverbot.at/blog/2012/05/purity-in-d/ — David I'm pretty sure that I've read that. But

Re: code.dlang community transfer repository

2015-04-24 Thread Martin Nowak via Digitalmars-d
On 04/23/2015 05:43 PM, Jesse Phillips wrote: In order to keep the projects in code.dlang.org relevant, I think it is important that we provide a way to have the primary project change hands, rather than require the fork be placed on to code.dlang.org too[2]. Write a mail to Söhnke, he can

Re: code.dlang community transfer repository

2015-04-24 Thread Martin Nowak via Digitalmars-d
On 04/23/2015 08:49 PM, Steven Schveighoffer wrote: If you are going to fork, you need to give it a new name. This is standard practice for open source projects. It's a common practice on github to take over small but no longer maintained projects. You give credit to the original author and

Re: A valid code that won't run?

2015-04-24 Thread cym13 via Digitalmars-d
On Friday, 24 April 2015 at 17:14:53 UTC, Steven Schveighoffer wrote: On 4/24/15 1:05 PM, cym13 wrote: I don't remember if std.algorithm.each existed in v2.066 but I find it hard to believe that it is that recent an addition to phobos. It is: https://issues.dlang.org/show_bug.cgi?id=12409

Re: Cleaned up C++

2015-04-24 Thread deadalnix via Digitalmars-d
On Friday, 24 April 2015 at 08:16:40 UTC, Walter Bright wrote: On 4/24/2015 12:23 AM, John Colvin wrote: Except of course that alloca is a lot cheaper than malloc/free. That's not necessarily true. But in any case, go ahead and use it if you like. Just prepare to benchmark and be

Re: A valid code that won't run?

2015-04-24 Thread Iain Buclaw via Digitalmars-d
On 24 April 2015 at 19:34, cym13 via Digitalmars-d digitalmars-d@puremagic.com wrote: On Friday, 24 April 2015 at 17:26:03 UTC, Marc Schütz wrote: On Friday, 24 April 2015 at 17:14:53 UTC, Steven Schveighoffer wrote: On 4/24/15 1:05 PM, cym13 wrote: $ dmd test.d

Re: A valid code that won't run?

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d
On 4/24/15 1:37 PM, Iain Buclaw via Digitalmars-d wrote: You need to explicitly link third party libraries. You shouldn't need to explicitly link anything that comes out of phobos IMO. -Steve

Re: GC.malloc is pure - wat

2015-04-24 Thread anonymous via Digitalmars-d
On Friday, 24 April 2015 at 17:07:20 UTC, deadalnix wrote: On Friday, 24 April 2015 at 15:43:17 UTC, anonymous wrote: [...] Could core.stdc.stdlib.malloc and friends also be marked pure then? No. Allocating on the GC is stateless as the GC will handle the state by itself, from the program

md5 return toHexString

2015-04-24 Thread AndyC via Digitalmars-d-learn
Hi All, I cannot seem to understand whats wrong with this: // main.d import std.stdio; import std.digest.md; import std.file; string md5sum(const string fname) { MD5 hash; File f = File(fname, rb); foreach( ubyte[] buf; f.byChunk(4096)) { hash.put(buf); }

Re: md5 return toHexString

2015-04-24 Thread tcak via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:50:03 UTC, AndyC wrote: Hi All, I cannot seem to understand whats wrong with this: // main.d import std.stdio; import std.digest.md; import std.file; string md5sum(const string fname) { MD5 hash; File f = File(fname, rb); foreach( ubyte[] buf;

Re: GC.malloc is pure - wat

2015-04-24 Thread David Nadlinger via Digitalmars-d
On Friday, 24 April 2015 at 15:05:15 UTC, anonymous wrote: auto v = f(x); auto w = f(x); When f is pure, a compiler should be free to reuse the value of v for w. That's no good with GC.malloc, obviously. In case there is further confusion about purity in D, let me do a shameless plug

Re: md5 return toHexString

2015-04-24 Thread AndyC via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:56:59 UTC, tcak wrote: On Friday, 24 April 2015 at 17:50:03 UTC, AndyC wrote: Hi All, I cannot seem to understand whats wrong with this: // main.d import std.stdio; import std.digest.md; import std.file; string md5sum(const string fname) { MD5 hash; File

Re: Convert hex to binary

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/15 2:14 PM, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = 123456789ABCDEF myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks for suggestions! import

Re: Startup files for STM32F4xx

2015-04-24 Thread Mike via Digitalmars-d-learn
On Saturday, 25 April 2015 at 00:33:26 UTC, Steven Schveighoffer wrote: http://www.digikey.com/product-search/en?x=0y=0lang=ensite=uskeywords=stm32f429+discovery This is super tempting @ $24. As someone who is not used to tinkering with raw hardware, how does one power this thing? I've

[Issue 14498] New: Poor codegen optimization for ranges

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14498 Issue ID: 14498 Summary: Poor codegen optimization for ranges Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal

Re: Cleaned up C++

2015-04-24 Thread Walter Bright via Digitalmars-d
On 4/24/2015 10:27 AM, deadalnix wrote: On Friday, 24 April 2015 at 08:16:40 UTC, Walter Bright wrote: On 4/24/2015 12:23 AM, John Colvin wrote: Except of course that alloca is a lot cheaper than malloc/free. That's not necessarily true. But in any case, go ahead and use it if you like. Just

Re: A valid code that won't run?

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d
On 4/24/15 5:06 PM, Dicebot wrote: On Friday, 24 April 2015 at 20:52:16 UTC, Steven Schveighoffer wrote: On 4/24/15 4:36 PM, Dicebot wrote: On Friday, 24 April 2015 at 20:27:28 UTC, Steven Schveighoffer wrote: If pragma(lib, libcurl); doesn't work normally, then we should remove std.net.curl,

Re: Cleaned up C++

2015-04-24 Thread Walter Bright via Digitalmars-d
On 4/24/2015 5:59 AM, John Colvin wrote: one reason why it might be faster is that e.g. gcc can produce code like this: #includealloca.h void bar(char* a); void foo(unsigned int n) { char *a = (char*)alloca(n); bar(a); } foo: movl%edi, %eax pushq%rbp addq$46,

Re: Range of chars (narrow string ranges)

2015-04-24 Thread Jonathan M Davis via Digitalmars-d
On Friday, 24 April 2015 at 20:44:34 UTC, Walter Bright wrote: On 4/24/2015 11:52 AM, H. S. Teoh via Digitalmars-d wrote: I really wish we would just *make the darn decision* already, whether to kill off autodecoding or not, and MAKE IT CONSISTENT ACROSS PHOBOS, instead of introducing this

[Issue 14481] [REG2.066] ICE with forward reference of manifest constant on template arguments

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14481 --- Comment #2 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/30fad36dac6a2fb4855f46f2a0e61548a9a8210b fix Issue 14481 - ICE with

[Issue 14481] [REG2.066] ICE with forward reference of manifest constant on template arguments

2015-04-24 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14481 github-bugzi...@puremagic.com changed: What|Removed |Added Status|NEW |RESOLVED

Re: GC.malloc is pure - wat

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d
On 4/24/15 8:30 PM, weaselcat wrote: On Friday, 24 April 2015 at 23:27:36 UTC, Steven Schveighoffer wrote: All I'm saying is that GC.malloc alters global state. I agree that it's OK to pretend that it doesn't because as long as you agree not to base things on this knowledge, you are fine

Re: Range of chars (narrow string ranges)

2015-04-24 Thread Martin Nowak via Digitalmars-d
On 04/24/2015 10:44 PM, Walter Bright wrote: 4. Autodecoding is inefficient, especially considering that few algorithms actually need decoding. Re-encoding the result back to UTF8 is another inefficiency. I'm afraid we are stuck with autodecoding, as taking it out may be far too disruptive.

Re: How to output ascii character using terminal.d

2015-04-24 Thread Adam D. Ruppe via Digitalmars-d-learn
Also try cast(dchar) instead of cast(char), that might do what you need.

Re: GC.malloc is pure - wat

2015-04-24 Thread Steven Schveighoffer via Digitalmars-d
On 4/24/15 5:07 PM, deadalnix wrote: On Friday, 24 April 2015 at 20:55:02 UTC, Steven Schveighoffer wrote: But I can check memory usage size and see global state has been altered. OK, if you want to play that game, don't access memory ever, that is global state. I mean, even if the memory is

  1   2   3   >