Re: howto count lines - fast

2017-05-31 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 31, 2017 at 10:05:50PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > On Thursday, June 01, 2017 04:52:40 Patrick Schluter via Digitalmars-d-learn [...] > > See my link above to realdworldtech. Using SIMD can give good > > results in micro-benchmarks but completely screw up

Re: howto count lines - fast

2017-05-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, June 01, 2017 04:52:40 Patrick Schluter via Digitalmars-d-learn wrote: > On Thursday, 1 June 2017 at 04:39:17 UTC, Jonathan M Davis wrote: > > On Wednesday, May 31, 2017 16:03:54 H. S. Teoh via > > > > Digitalmars-d-learn wrote: > >> [...] > > > > Digitalmars-d-learn wrote: > >>

Re: Bad array indexing is considered deadly

2017-05-31 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, May 31, 2017 23:20:54 Nick Sabalausky via Digitalmars-d wrote: > On 05/31/2017 10:50 PM, Jonathan M Davis via Digitalmars-d wrote: > > Yes, there may be cases where array indices are effectively coming from > > user input, and you're going to have to check them all rather than the

Re: Research Positions

2017-05-31 Thread rikki cattermole via Digitalmars-d-announce
On 31/05/2017 7:24 PM, Chris wrote: On Wednesday, 31 May 2017 at 18:20:57 UTC, Chris wrote: On Wednesday, 31 May 2017 at 15:15:00 UTC, rikki cattermole wrote: On 31/05/2017 2:10 PM, Chris wrote: [...] As long as the positions can be done in D (and the desire is there by those involved)

Re: howto count lines - fast

2017-05-31 Thread Patrick Schluter via Digitalmars-d-learn
On Thursday, 1 June 2017 at 04:39:17 UTC, Jonathan M Davis wrote: On Wednesday, May 31, 2017 16:03:54 H. S. Teoh via Digitalmars-d-learn wrote: [...] Digitalmars-d-learn wrote: [...] If you're really trying to make it fast, there may be something that you can do with SIMD. IIRC, Brian

Re: howto count lines - fast

2017-05-31 Thread Patrick Schluter via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 23:03:54 UTC, H. S. Teoh wrote: On Wed, May 31, 2017 at 03:46:17PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: On Wednesday, May 31, 2017 12:13:04 H. S. Teoh via Digitalmars-d-learn wrote: > I did some digging around, and it seems that wc is using >

Re: howto count lines - fast

2017-05-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, May 31, 2017 16:03:54 H. S. Teoh via Digitalmars-d-learn wrote: > On Wed, May 31, 2017 at 03:46:17PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Wednesday, May 31, 2017 12:13:04 H. S. Teoh via Digitalmars-d-learn > > > > wrote: > > > I did some digging around, and

Re: Bad array indexing is considered deadly

2017-05-31 Thread John Carter via Digitalmars-d
On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: For example: int[3] arr; arr[3] = 5; Technically this is a programming error, and a bug. But memory hasn't actually been corrupted. The system properly stopped me from corrupting memory. But my reward is that even though

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 10:50 PM, Jonathan M Davis via Digitalmars-d wrote: On Wednesday, May 31, 2017 22:33:43 Nick Sabalausky via Digitalmars-d wrote: On 05/31/2017 05:00 PM, Steven Schveighoffer wrote: On 5/31/17 3:17 PM, Moritz Maxeiner wrote: So in your specific use case I would say use a

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 10:39 PM, Jonathan M Davis via Digitalmars-d wrote: On Wednesday, May 31, 2017 22:24:16 Nick Sabalausky via Digitalmars-d wrote: On 05/31/2017 05:00 PM, Steven Schveighoffer wrote: But that ship, as I said elsewhere, has sailed. We can't change it to Exception now, as that would

Re: Rosetta Commatizing numbers

2017-05-31 Thread Solomon E via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 15:44:51 UTC, Ivan Kazmenko wrote: On Wednesday, 31 May 2017 at 13:27:24 UTC, Solomon E wrote: Fine, by the numbers: 1. pi has the commas start at the wrong digit, and doesn't follow the explicit instructions to use spaces as the separator and a grouping of 5

Re: Bad array indexing is considered deadly

2017-05-31 Thread Walter Bright via Digitalmars-d
On 5/31/2017 7:39 PM, Jonathan M Davis via Digitalmars-d wrote: The reality of the matter though is that no matter what we do, a completely robust program must be able to deal with the fact that it could be killed at any time (e.g. due to a power outage) - not that it needs to function perfectly

Re: Bad array indexing is considered deadly

2017-05-31 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, May 31, 2017 22:33:43 Nick Sabalausky via Digitalmars-d wrote: > On 05/31/2017 05:00 PM, Steven Schveighoffer wrote: > > On 5/31/17 3:17 PM, Moritz Maxeiner wrote: > >> So in your specific use case I would say use a wrapper. This is one of > >> the reasons why I am working on my

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread Nicholas Wilson via Digitalmars-d-announce
On Thursday, 1 June 2017 at 01:45:24 UTC, Andrei Alexandrescu wrote: You're right. Congratulations Nicholas for this great work and I wish it succeeds by any name he chooses for it. -- Andrei And nothing increases chances of success like contributions! (subtle hint)

Re: Bad array indexing is considered deadly

2017-05-31 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, May 31, 2017 22:24:16 Nick Sabalausky via Digitalmars-d wrote: > On 05/31/2017 05:00 PM, Steven Schveighoffer wrote: > > But that ship, as I said elsewhere, has sailed. We can't change it to > > Exception now, as that would break just about all nothrow code in > > existence. > >

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 05:00 PM, Steven Schveighoffer wrote: On 5/31/17 3:17 PM, Moritz Maxeiner wrote: So in your specific use case I would say use a wrapper. This is one of the reasons why I am working on my own library for data structures (libds). That is my conclusion too. Honestly, I really

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 05:00 PM, Steven Schveighoffer wrote: But that ship, as I said elsewhere, has sailed. We can't change it to Exception now, as that would break just about all nothrow code in existence. This is why the runtime needs to guarantee that normal unwinding/cleanup *does* occur on

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 05:03 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 20:23:21 UTC, Nick Sabalausky (Abscissa) wrote: On 05/31/2017 03:17 PM, Moritz Maxeiner wrote: in general you have to assume that the index *being* out of bounds is itself the *result* of *already occurred* data

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread Nicholas Wilson via Digitalmars-d-announce
On Thursday, 1 June 2017 at 01:42:16 UTC, Andrei Alexandrescu wrote: On 5/31/17 7:28 PM, Nicholas Wilson wrote: On Wednesday, 31 May 2017 at 22:15:33 UTC, Wulfklaue wrote: On Wednesday, 31 May 2017 at 12:28:47 UTC, Nicholas Wilson wrote: Perhaps there will be scope for renaming if/when this

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 31 May 2017 at 22:03:25 UTC, Jonathan M Davis wrote: Yes, the name matters, but this thread has been pretty thoroughly derailed from its original purpose. - Jonathan M Davis https://www.xkcd.com/386/

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 5/31/17 6:03 PM, Jonathan M Davis via Digitalmars-d-announce wrote: On Wednesday, May 31, 2017 18:55:14 bachmeier via Digitalmars-d-announce wrote: On Wednesday, 31 May 2017 at 12:28:47 UTC, Nicholas Wilson wrote: But can we please reduce the bike shedding Marketing is only bike shedding

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread Andrei Alexandrescu via Digitalmars-d-announce
On 5/31/17 7:28 PM, Nicholas Wilson wrote: On Wednesday, 31 May 2017 at 22:15:33 UTC, Wulfklaue wrote: On Wednesday, 31 May 2017 at 12:28:47 UTC, Nicholas Wilson wrote: Perhaps there will be scope for renaming if/when this also includes graphics when either OpenCL is merged into the Vulkan API

Re: Bad array indexing is considered deadly

2017-05-31 Thread Brad Roberts via Digitalmars-d
On 5/31/2017 5:37 PM, John Colvin via Digitalmars-d wrote: P.S. Sometimes I do feel D is a bit eager on the self-destruct switch, but I think the solution is to rise to the challenge of making better software, not to be more blasé about pretending to know how to recover from unknown logic

Re: Bad array indexing is considered deadly

2017-05-31 Thread Walter Bright via Digitalmars-d
On 5/31/2017 6:04 AM, Steven Schveighoffer wrote: Technically this is a programming error, and a bug. But memory hasn't actually been corrupted. Since you don't know where the bad index came from, such a conclusion cannot be drawn. This seems like a large penalty for "almost" corrupting

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Thursday, 1 June 2017 at 00:11:10 UTC, Timon Gehr wrote: On 01.06.2017 01:55, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 23:40:00 UTC, Timon Gehr wrote: In the context of the conversation, and error has already occurred and the all cases was referring to all the cases that lead

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 23:53:11 UTC, Steven Schveighoffer wrote: On 5/31/17 7:13 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 22:47:38 UTC, Steven Schveighoffer wrote: Again, there has not been memory corruption. Again, the runtime *cannot* know that and hence you *cannot*

Re: Bad array indexing is considered deadly

2017-05-31 Thread John Colvin via Digitalmars-d
On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: I have discovered an annoyance in using vibe.d instead of another web framework. Simple errors in indexing crash the entire application. For example: int[3] arr; arr[3] = 5; Compare this to, let's say, a malformed

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 23:51:30 UTC, Jonathan M Davis wrote: On Wednesday, May 31, 2017 23:13:35 Moritz Maxeiner via Digitalmars-d wrote: On Wednesday, 31 May 2017 at 22:47:38 UTC, Steven Schveighoffer wrote: > Again, there has not been memory corruption. Again, the runtime *cannot*

Re: Bad array indexing is considered deadly

2017-05-31 Thread Timon Gehr via Digitalmars-d
On 01.06.2017 01:55, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 23:40:00 UTC, Timon Gehr wrote: In the context of the conversation, and error has already occurred and the all cases was referring to all the cases that lead to the error. Bounds checks have /no business at all/ trying

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 23:50:07 UTC, Timon Gehr wrote: No, it is perfectly safe, because the language does not guarantee any specific behavior in case memory is corrupted. The language not guaranteeing a specific behaviour on memory corruption does not imply that assuming a bug was

Re: Rosetta Commatizing numbers

2017-05-31 Thread Mike B Johnson via Digitalmars-d-learn
If you still insist you are doing the right thing and all others are wrong, let's agree to disagree on that, and please just leave the original solution there by introducing two versions. Or we could just agree that the original was wrong and needs fixing? That is obviously the right thing

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 23:40:00 UTC, Timon Gehr wrote: In the context of the conversation, and error has already occurred and the all cases was referring to all the cases that lead to the error. Bounds checks have /no business at all/ trying to handle preexisting memory corruption,

Re: Bad array indexing is considered deadly

2017-05-31 Thread Steven Schveighoffer via Digitalmars-d
On 5/31/17 7:13 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 22:47:38 UTC, Steven Schveighoffer wrote: Again, there has not been memory corruption. Again, the runtime *cannot* know that and hence you *cannot* claim that. It sees an index out of bounds and it *cannot* reason about

Re: Bad array indexing is considered deadly

2017-05-31 Thread Timon Gehr via Digitalmars-d
On 01.06.2017 01:13, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 22:47:38 UTC, Steven Schveighoffer wrote: Again, there has not been memory corruption. Again, the runtime *cannot* know that and hence you *cannot* claim that. It sees an index out of bounds and it *cannot* reason

Re: Bad array indexing is considered deadly

2017-05-31 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, May 31, 2017 23:13:35 Moritz Maxeiner via Digitalmars-d wrote: > On Wednesday, 31 May 2017 at 22:47:38 UTC, Steven Schveighoffer > wrote: > > Again, there has not been memory corruption. > > Again, the runtime *cannot* know that and hence you *cannot* > claim that. It sees an index

Re: howto count lines - fast

2017-05-31 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jun 01, 2017 at 12:20:53AM +0100, Russel Winder via Digitalmars-d-learn wrote: [...] > However, I note here that the Chapel folk are taking a quite > interesting view of algorithm implementation in the Benchmarks Game. > They are totally eschewing "heroic implementations" such as all the

Re: Bad array indexing is considered deadly

2017-05-31 Thread Timon Gehr via Digitalmars-d
On 01.06.2017 00:22, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 21:29:53 UTC, Timon Gehr wrote: On 31.05.2017 22:45, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 20:09:16 UTC, Nick Sabalausky (Abscissa) wrote: [...] program is in an undefined state and should terminate asap.

Re: Could DRuntime be implemented as a shared library?

2017-05-31 Thread Nicholas Wilson via Digitalmars-d
On Wednesday, 31 May 2017 at 19:58:44 UTC, solidstate1991 wrote: Won't work, TypeInfo doesn't cross the shared library boundary atm. This is probably the real blocker for shared libs on Windows (includes Phobos as a DLL). The GC can be swapped out already at runtime, just need shared libs to

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread Nicholas Wilson via Digitalmars-d-announce
On Wednesday, 31 May 2017 at 22:15:33 UTC, Wulfklaue wrote: On Wednesday, 31 May 2017 at 12:28:47 UTC, Nicholas Wilson wrote: Perhaps there will be scope for renaming if/when this also includes graphics when either OpenCL is merged into the Vulkan API or Petar Kirov gets Vulkan SPIRV

Re: howto count lines - fast

2017-05-31 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2017-05-30 at 17:22 -0700, H. S. Teoh via Digitalmars-d-learn wrote: > […] > performance in a significant way.  But I thought this might be a > useful > tip for people who want to squeeze out the last drop of juice from > their > CPUs. ;-) > […] I have the beginnings of wc written in

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 22:47:38 UTC, Steven Schveighoffer wrote: Again, there has not been memory corruption. Again, the runtime *cannot* know that and hence you *cannot* claim that. It sees an index out of bounds and it *cannot* reason about whether a memory corruption has already

[Issue 17451] ICE in ddmd/declaration.d(2179)

2017-05-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17451 --- Comment #6 from github-bugzi...@puremagic.com --- Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/a98029d193806d78d4c3a8ad30adbfa07822f0ae fix Issue 17451 - ICE in ddmd/declaration.d(2179)

Re: howto count lines - fast

2017-05-31 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, May 31, 2017 at 03:46:17PM -0700, Jonathan M Davis via Digitalmars-d-learn wrote: > On Wednesday, May 31, 2017 12:13:04 H. S. Teoh via Digitalmars-d-learn > wrote: > > I did some digging around, and it seems that wc is using glibc's > > memchr, which is highly-optimized, whereas

[Issue 17352] [REG 2.075a] Internal error: ddmd/backend/elfobj.c 1739 on duplicate definition

2017-05-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17352 --- Comment #5 from Martin Nowak --- (In reply to Ketmar Dark from comment #4) > i mean, yes, the frontend should check for conflicting overloads even if > they weren't called anywhere. Could be easily checked in overloadInsert et.al.

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 22:42:30 UTC, Jonathan M Davis wrote: I don't think that you even need to worry about whether memory corruption occurred prior to indexing the array with an invalid index. The fact that the array was indexed with an invalid index is a bug. What caused the bug

Re: Bad array indexing is considered deadly

2017-05-31 Thread Steven Schveighoffer via Digitalmars-d
On 5/31/17 6:36 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 21:45:51 UTC, H. S. Teoh wrote: This is an interesting use case, because conceptually speaking, each vibe.d fibre actually represents an independent computation, so any fatal errors like out-of-bounds bugs should cause the

Re: Bad array indexing is considered deadly

2017-05-31 Thread Steven Schveighoffer via Digitalmars-d
On 5/31/17 5:30 PM, Ali Çehreli wrote: On 05/31/2017 02:00 PM, Steven Schveighoffer wrote: On 5/31/17 3:17 PM, Moritz Maxeiner wrote: It is not that accessing the array out of bounds *leading* to data corruption that is the issue here, but that in general you have to assume that the index

Re: howto count lines - fast

2017-05-31 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, May 31, 2017 12:13:04 H. S. Teoh via Digitalmars-d-learn wrote: > I did some digging around, and it seems that wc is using glibc's memchr, > which is highly-optimized, whereas std.algorithm.count just uses a > simplistic loop. Which is strange, because I'm pretty sure somebody >

Re: Bad array indexing is considered deadly

2017-05-31 Thread Jonathan M Davis via Digitalmars-d
On Wednesday, May 31, 2017 19:17:16 Moritz Maxeiner via Digitalmars-d wrote: > On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer > > wrote: > > [...] > > > > What are your thoughts? Have you run into this? If so, how did > > you solve it? > > It is not that accessing the array out of

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 21:45:51 UTC, H. S. Teoh wrote: This is an interesting use case, because conceptually speaking, each vibe.d fibre actually represents an independent computation, so any fatal errors like out-of-bounds bugs should cause the termination of the *fibre*, rather than

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 21:30:47 UTC, H. S. Teoh wrote: On Wed, May 31, 2017 at 11:29:53PM +0200, Timon Gehr via Digitalmars-d wrote: On 31.05.2017 22:45, Moritz Maxeiner wrote: [...] > No, because as I stated in my other post, the runtime > *cannot* assume that it is safe *in all

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 21:29:53 UTC, Timon Gehr wrote: On 31.05.2017 22:45, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 20:09:16 UTC, Nick Sabalausky (Abscissa) wrote: [...] program is in an undefined state and should terminate asap. Then out-of-bounds and assert failures

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread Wulfklaue via Digitalmars-d-announce
On Wednesday, 31 May 2017 at 12:28:47 UTC, Nicholas Wilson wrote: Perhaps there will be scope for renaming if/when this also includes graphics when either OpenCL is merged into the Vulkan API or Petar Kirov gets Vulkan SPIRV generation going on LLVM, but for now the name stays. People who

[Issue 17453] I Have Many Issues

2017-05-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17453 --- Comment #7 from Soar --- > > 3.can more good support for IntelliSense? such like "this.?" "variable.?" > > You might want to have a look at the language optionss (accessible through > the Visual D menu), especially "show

Re: Bad array indexing is considered deadly

2017-05-31 Thread Ali Çehreli via Digitalmars-d
On 05/31/2017 02:41 PM, Ola Fosheim Grøstad wrote: > On Wednesday, 31 May 2017 at 21:30:05 UTC, Ali Çehreli wrote: >> How could an Exception work in this case? Catch it and repeat the same >> bug over and over again? What would the program be achieving? (I >> assume the exception handler will not

[Issue 17448] Move semantics cause memory corruption and cryptic bugs

2017-05-31 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=17448 Stanislav Blinov changed: What|Removed |Added CC|

Re: Bad array indexing is considered deadly

2017-05-31 Thread H. S. Teoh via Digitalmars-d
On Wed, May 31, 2017 at 02:30:05PM -0700, Ali Çehreli via Digitalmars-d wrote: > On 05/31/2017 02:00 PM, Steven Schveighoffer wrote: [...] > > The runtime should not assume that crashing the whole program is > > necessary when an integer is out of range. Preventing actual > > corruption, yes that

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 21:00:43 UTC, Steven Schveighoffer wrote: On 5/31/17 3:17 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: [...] What are your thoughts? Have you run into this? If so, how did you solve it? It is not that

Re: Bad array indexing is considered deadly

2017-05-31 Thread Ola Fosheim Grøstad via Digitalmars-d
On Wednesday, 31 May 2017 at 21:30:05 UTC, Ali Çehreli wrote: How could an Exception work in this case? Catch it and repeat the same bug over and over again? What would the program be achieving? (I assume the exception handler will not arbitrarily decrease index values.) How is this

Re: Bad array indexing is considered deadly

2017-05-31 Thread H. S. Teoh via Digitalmars-d
On Wed, May 31, 2017 at 11:29:53PM +0200, Timon Gehr via Digitalmars-d wrote: > On 31.05.2017 22:45, Moritz Maxeiner wrote: [...] > > No, because as I stated in my other post, the runtime *cannot* > > assume that it is safe *in all cases*. If there is even one single > > case in which it is

Re: Bad array indexing is considered deadly

2017-05-31 Thread Ali Çehreli via Digitalmars-d
On 05/31/2017 02:00 PM, Steven Schveighoffer wrote: > On 5/31/17 3:17 PM, Moritz Maxeiner wrote: >> It is not that accessing the array out of bounds *leading* to data >> corruption that is the issue here, but that in general you have to >> assume that the index *being* out of bounds is itself

Re: Bad array indexing is considered deadly

2017-05-31 Thread Timon Gehr via Digitalmars-d
On 31.05.2017 22:45, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 20:09:16 UTC, Nick Sabalausky (Abscissa) wrote: [...] program is in an undefined state and should terminate asap. Then out-of-bounds and assert failures should be Exception not Error. Frankly, even out-of-memory,

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 21:02:06 UTC, Steven Schveighoffer wrote: Nope, an autonomous system did not type out my code that caused the out of bounds error, I did :) Same as the human who typed out the code of the autonomous system.

OT: Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 21:03:02 UTC, Steven Schveighoffer wrote: No, this is Linux, so I'll have to research how to properly do it with systemd. OT: *with whatever process supervisor floats your boat.

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 20:23:21 UTC, Nick Sabalausky (Abscissa) wrote: On 05/31/2017 03:17 PM, Moritz Maxeiner wrote: in general you have to assume that the index *being* out of bounds is itself the *result* of *already occurred* data corruption; Of course not, that's absurd. Where do

Re: Bad array indexing is considered deadly

2017-05-31 Thread Steven Schveighoffer via Digitalmars-d
On 5/31/17 4:53 PM, Kagamin wrote: On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: This seems like a large penalty for "almost" corrupting memory. No other web framework I've used crashes the entire web server for such a simple programming error. On windows you can set

Re: Bad array indexing is considered deadly

2017-05-31 Thread Steven Schveighoffer via Digitalmars-d
On 5/31/17 4:06 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: This is like the equivalent of having a guard rail on a road not only stop you from going off the cliff but proactively disable your car afterwards to prevent you from more harm.

Re: Bad array indexing is considered deadly

2017-05-31 Thread Steven Schveighoffer via Digitalmars-d
On 5/31/17 3:17 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: [...] What are your thoughts? Have you run into this? If so, how did you solve it? It is not that accessing the array out of bounds *leading* to data corruption that is the

Re: Is license.txt file in DMD builds up to date?

2017-05-31 Thread bachmeier via Digitalmars-d
On Wednesday, 31 May 2017 at 19:51:49 UTC, Username wrote: Hello, I've tried to find some information about the license file for DMD in windows builds(I'm not sure if it's used for other platforms). I'm new to D, literally just downloaded the compiler, but as far as I understand the licensing

Re: Changing Template Static Ifs to Recursion

2017-05-31 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 19:22:18 UTC, Stefan Koch wrote: You could also use string mixins. Which will be more efficient then recursion. I try to avoid string mixins unless I can't help it. Nevertheless, I made an effort to try to get it to work and below seems to be working. I still

Re: Bad array indexing is considered deadly

2017-05-31 Thread Kagamin via Digitalmars-d
On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: This seems like a large penalty for "almost" corrupting memory. No other web framework I've used crashes the entire web server for such a simple programming error. On windows you can set up service restart settings in case

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 20:09:16 UTC, Nick Sabalausky (Abscissa) wrote: [...] program is in an undefined state and should terminate asap. Then out-of-bounds and assert failures should be Exception not Error. Frankly, even out-of-memory, arguably. And then there's null dereference... In

Re: howto count lines - fast

2017-05-31 Thread Nitram via Digitalmars-d-learn
I am glad to see this participation on this issue :) The hints about trying another compiler and std.mmfile turned out to be very effective. Even this simple code is faster then my systems "wc -l" now: void main() { import std.stdio; writeln(lcs("benchmark.dat")); } size_t

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 03:17 PM, Moritz Maxeiner wrote: in general you have to assume that the index *being* out of bounds is itself the *result* of *already occurred* data corruption; Of course not, that's absurd. Where do people get the idea that out-of-bounds *implies* pre-existing data corruption?

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 02:55 PM, Moritz Maxeiner wrote: On Wednesday, 31 May 2017 at 17:13:08 UTC, Nick Sabalausky (Abscissa) wrote: On 05/31/2017 09:04 AM, Steven Schveighoffer wrote: What are your thoughts? +1 million. I *hate* D's notion of Error. Well, no...more correctly, I absolutely hate

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: This is like the equivalent of having a guard rail on a road not only stop you from going off the cliff but proactively disable your car afterwards to prevent you from more harm. Sorry for double post, but - after

Re: Could DRuntime be implemented as a shared library?

2017-05-31 Thread solidstate1991 via Digitalmars-d
Won't work, TypeInfo doesn't cross the shared library boundary atm. This is probably the real blocker for shared libs on Windows (includes Phobos as a DLL). The GC can be swapped out already at runtime, just need shared libs to be working properly :) Where can I read more about this

Re: howto count lines - fast

2017-05-31 Thread Patrick Schluter via Digitalmars-d-learn
On Tuesday, 30 May 2017 at 23:41:01 UTC, H. S. Teoh wrote: On Tue, May 30, 2017 at 08:02:38PM +, Nitram via Digitalmars-d-learn wrote: After reading https://dlang.org/blog/2017/05/24/faster-command-line-tools-in-d/ , i was wondering how fast one can do a simple "wc -l" in D. size_t

Is license.txt file in DMD builds up to date?

2017-05-31 Thread Username via Digitalmars-d
Hello, I've tried to find some information about the license file for DMD in windows builds(I'm not sure if it's used for other platforms). I'm new to D, literally just downloaded the compiler, but as far as I understand the licensing of DMD looks like this: runtime, phobos and compiler

Re: Changing Template Static Ifs to Recursion

2017-05-31 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 19:25:22 UTC, ag0aep6g wrote: On 05/31/2017 08:50 PM, jmh530 wrote: Note: I left out the function foo, but think of foo is to Foo as tuple is to Tuple. You should have included foo, in my opinion. I'm having trouble figuring out what your code does. `process`

Re: Changing Template Static Ifs to Recursion

2017-05-31 Thread ag0aep6g via Digitalmars-d-learn
On 05/31/2017 08:50 PM, jmh530 wrote: Note: I left out the function foo, but think of foo is to Foo as tuple is to Tuple. You should have included foo, in my opinion. I'm having trouble figuring out what your code does. `process` instantiates foo with the field names. I'd need the definition

Re: Changing Template Static Ifs to Recursion

2017-05-31 Thread Stefan Koch via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 18:50:27 UTC, jmh530 wrote: I have a struct that I am using like a Tuple, but I want to be able to opIndex in a different way than Tuple's opIndex. I want to be able to opIndex whatever is underlying the Tuple. [...] You could also use string mixins. Which will

Re: howto count lines - fast

2017-05-31 Thread H. S. Teoh via Digitalmars-d-learn
On Tue, May 30, 2017 at 05:13:46PM -0700, Ali Çehreli via Digitalmars-d-learn wrote: [...] > I could not make the D program come close to wc's performance when the > data was piped from stdin. [...] Hmm. This is a particularly interesting case, because I adapted some of my algorithms to handle

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 13:04:52 UTC, Steven Schveighoffer wrote: [...] What are your thoughts? Have you run into this? If so, how did you solve it? It is not that accessing the array out of bounds *leading* to data corruption that is the issue here, but that in general you have to

Re: DCompute is now in the master branch of LDC

2017-05-31 Thread bachmeier via Digitalmars-d-announce
On Wednesday, 31 May 2017 at 12:28:47 UTC, Nicholas Wilson wrote: I am more inclined to be persuaded by the fact that everybody that has actually done GPU programming has said that it makes sense to them. It would be a mistake to judge that on the basis of those posting in this forum. I've

Re: Bad array indexing is considered deadly

2017-05-31 Thread Moritz Maxeiner via Digitalmars-d
On Wednesday, 31 May 2017 at 17:13:08 UTC, Nick Sabalausky (Abscissa) wrote: On 05/31/2017 09:04 AM, Steven Schveighoffer wrote: What are your thoughts? +1 million. I *hate* D's notion of Error. Well, no...more correctly, I absolutely hate that it throws cleanup/unwinding straight out the

Changing Template Static Ifs to Recursion

2017-05-31 Thread jmh530 via Digitalmars-d-learn
I have a struct that I am using like a Tuple, but I want to be able to opIndex in a different way than Tuple's opIndex. I want to be able to opIndex whatever is underlying the Tuple. The code below works, but is kind of annoying because to extend you have to keep adding static ifs. I want to

Re: Research Positions

2017-05-31 Thread Chris via Digitalmars-d-announce
On Wednesday, 31 May 2017 at 18:20:57 UTC, Chris wrote: On Wednesday, 31 May 2017 at 15:15:00 UTC, rikki cattermole wrote: On 31/05/2017 2:10 PM, Chris wrote: [...] As long as the positions can be done in D (and the desire is there by those involved) then it does belong here. Given Chris

Re: Research Positions

2017-05-31 Thread Chris via Digitalmars-d-announce
On Wednesday, 31 May 2017 at 15:15:00 UTC, rikki cattermole wrote: On 31/05/2017 2:10 PM, Chris wrote: On Wednesday, 31 May 2017 at 11:26:43 UTC, Joakim wrote: [...] In case anyone with a D background is interested in one of the positions. We use D for speech synthesis and it'd be great if

Re: howto count lines - fast

2017-05-31 Thread cym13 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 17:23:46 UTC, Ali Çehreli wrote: On 05/30/2017 11:50 PM, Daniel Kozak via Digitalmars-d-learn wrote: > How do you compile it? When I use ldc2 -O3 -release -mcpu=bdver1 lc.d > my code is even faster than wc My bad: I'm not familiar with ldc's optimization options.

Re: howto count lines - fast

2017-05-31 Thread Ali Çehreli via Digitalmars-d-learn
On 05/30/2017 11:50 PM, Daniel Kozak via Digitalmars-d-learn wrote: > How do you compile it? When I use ldc2 -O3 -release -mcpu=bdver1 lc.d > my code is even faster than wc My bad: I'm not familiar with ldc's optimization options. (I used -O3 but not -release) Now I get the same performance

Re: Question on @nothrow

2017-05-31 Thread Ali Çehreli via Digitalmars-d-learn
On 05/31/2017 02:10 AM, Vasileios Anagnostopoulos wrote: > compiler enforced @throws For that to be possible, the compiler would have to see all definitions, which is not possible with separate compilation. Besides, I think the only meaning of @throws would be "may throw". If so, since the

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 09:04 AM, Steven Schveighoffer wrote: What are your thoughts? +1 million. I *hate* D's notion of Error. Well, no...more correctly, I absolutely hate that it throws cleanup/unwinding straight out the window for many situations that can obviously be handled safely without the

Re: Bad array indexing is considered deadly

2017-05-31 Thread Nick Sabalausky (Abscissa) via Digitalmars-d
On 05/31/2017 09:34 AM, Steven Schveighoffer wrote: On 5/31/17 9:21 AM, H. S. Teoh via Digitalmars-d wrote: Isn't it customary to have the webserver launched by a script that restarts it whenever it crashes (after logging a message in an emergency logfile)? Not an ideal solution, I know, but

Re: Could DRuntime be implemented as a shared library?

2017-05-31 Thread rikki cattermole via Digitalmars-d
On 31/05/2017 4:57 PM, solidstate1991 wrote: Offloading at least the GC could enable the implementation of a per-application GC easier, as well as making development of shared libraries under Windows much easier, might even enable the offloading of Phobos into its own DLL. Won't work,

Could DRuntime be implemented as a shared library?

2017-05-31 Thread solidstate1991 via Digitalmars-d
Offloading at least the GC could enable the implementation of a per-application GC easier, as well as making development of shared libraries under Windows much easier, might even enable the offloading of Phobos into its own DLL. As an outsider, I think the biggest problem would be from the

Re: A Few thoughts on C, C++, and D

2017-05-31 Thread Ola Fosheim Grøstad via Digitalmars-d
On Wednesday, 31 May 2017 at 06:52:00 UTC, Jacob Carlborg wrote: But trying to compile the code in the "body" for Windows, on any other platform will fail because windows.h is not available. But you don't have to do that if it is built into the compiler?

Re: Rosetta Commatizing numbers

2017-05-31 Thread Ivan Kazmenko via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 13:27:24 UTC, Solomon E wrote: Fine, by the numbers: 1. pi has the commas start at the wrong digit, and doesn't follow the explicit instructions to use spaces as the separator and a grouping of 5 Can be solved by calling the function with a right set of

Re: Bad array indexing is considered deadly

2017-05-31 Thread ketmar via Digitalmars-d
Steven Schveighoffer wrote: On 5/31/17 10:07 AM, Steven Schveighoffer wrote: Here is complete implementation (should be @safe too): struct ExArr(T, size_t dim) { T[dim] _value; alias _value this; ref inout(T) opIndex(size_t idx, string fname = __FILE__, size_t linenum = __LINE__)

Re: iOS Apps in D

2017-05-31 Thread solidstate1991 via Digitalmars-d-learn
On Wednesday, 31 May 2017 at 12:49:38 UTC, Oleksii wrote: Hi everybody, Perhaps this topic has been raised many times before, but I'm going to go back to it anyways :-P Are there any good reference materials and/or tutorials on programming for iOS and Android in D? I wonder if anybody could

  1   2   >