Re: Hacking C code vs D code

2022-08-05 Thread pascal111 via Digitalmars-d-learn
On Friday, 5 August 2022 at 01:46:35 UTC, Paul Backus wrote: On Thursday, 4 August 2022 at 23:11:36 UTC, pascal111 wrote: One of problems faced me in C programming is hacking data with C code that some hackers do with C code which make me needs more tools to protect my C code, but I don't have

Re: Unittest Absurdity

2022-08-05 Thread frame via Digitalmars-d-learn
On Friday, 5 August 2022 at 21:24:13 UTC, Steven Schveighoffer wrote: That's not what I was talking about here. I'm talking about `-vcg-ast` not telling you how it's calling the function. Thanks for clarification. I had that in mind but wasn't sure. I first thought it just get optimized

Re: Unittest Absurdity

2022-08-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/5/22 3:53 PM, frame wrote: On Friday, 5 August 2022 at 15:24:16 UTC, Steven Schveighoffer wrote: oof, I expected this to include the template parameters! I believe it normally does? This is a bug that should be filed. -Steve Sorry, I don't get what you takling about? The docs says:

Re: Unittest Absurdity

2022-08-05 Thread frame via Digitalmars-d-learn
On Friday, 5 August 2022 at 15:24:16 UTC, Steven Schveighoffer wrote: oof, I expected this to include the template parameters! I believe it normally does? This is a bug that should be filed. -Steve Sorry, I don't get what you takling about? The docs says: The expression: `a op= b` is

Re: curses/ncurses liberary in D

2022-08-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 5 August 2022 at 18:20:36 UTC, pascal111 wrote: But I'll need help to understand some functions like how we can use "readf" equivalent, I don't see it. http://arsd-official.dpldocs.info/arsd.terminal.html#get-line get a line then strip it and convert to whatever numbers you want

Re: curses/ncurses liberary in D

2022-08-05 Thread pascal111 via Digitalmars-d-learn
On Friday, 5 August 2022 at 12:02:27 UTC, Adam D Ruppe wrote: On Friday, 5 August 2022 at 04:14:22 UTC, H. S. Teoh wrote: including cursorX, cursorY Worth noting these are not initialized in linear mode, only in fullscreen/cellular. I might change that soon, it is on my todo list.

Re: curses/ncurses liberary in D

2022-08-05 Thread pascal111 via Digitalmars-d-learn
On Friday, 5 August 2022 at 04:14:22 UTC, H. S. Teoh wrote: On Thu, Aug 04, 2022 at 11:52:48PM +, pascal111 via Digitalmars-d-learn wrote: On Thursday, 4 August 2022 at 21:35:37 UTC, Adam D Ruppe wrote: > On Thursday, 4 August 2022 at 21:15:39 UTC, pascal111 wrote: > > >

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 17:02:48 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 16:58:25 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 15:07:18 UTC, H. S. Teoh wrote: [SNIP] In other words, you're trying to construct a BigInt with a value of 10^18030 (a number with

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 16:58:25 UTC, Ruby The Roobster wrote: On Friday, 5 August 2022 at 15:07:18 UTC, H. S. Teoh wrote: [SNIP] In other words, you're trying to construct a BigInt with a value of 10^18030 (a number with 18030 digits) and wondering why the computer is taking forever to

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 15:07:18 UTC, H. S. Teoh wrote: [SNIP] In other words, you're trying to construct a BigInt with a value of 10^18030 (a number with 18030 digits) and wondering why the computer is taking forever to compute the value. :-D [SNIP] T I have no idea how the program

Re: Unittest Absurdity

2022-08-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/5/22 11:24 AM, Steven Schveighoffer wrote: On 8/4/22 10:27 PM, jfondren wrote:  a.opOpAssign(b);  b.opOpAssign(a); oof, I expected this to include the template parameters! I believe it normally does? It does not! I'm genuinely shocked. ```d void foo(string s, T)(T t) {} void

Re: Unittest Absurdity

2022-08-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/4/22 10:27 PM, jfondren wrote: The output's not that useful... ```d import object; struct S { int n; void opOpAssign(string op)(S rhs) if (op == "/=") {     n++; } void opOpAssign(string op)(S rhs) if (op == "/") { } } unittest { S a = S(1);   

Re: Ranges

2022-08-05 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Aug 05, 2022 at 08:06:00AM -0700, Ali Çehreli via Digitalmars-d-learn wrote: > [...] I realized that the following fails with a RangeError: > > void main() { > auto arr = [1, 2, 3]; > arr[0..$-1] = arr[1..$];// <-- Runtime error > } > > I suspect the length of the array is

Re: Ranges

2022-08-05 Thread Ali Çehreli via Digitalmars-d-learn
On 8/5/22 01:59, frame wrote: > On Thursday, 4 August 2022 at 22:14:26 UTC, Ali Çehreli wrote: > >> No element is copied or moved. :) >> >> Ali > > I know that :) And I know that. :) We don't know who else is reading these threads, so I didn't want to give wrong impression. Copying would

Re: Obscure Isssue #1

2022-08-05 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Aug 05, 2022 at 02:23:15PM +, Ruby The Roobster via Digitalmars-d-learn wrote: > On Friday, 5 August 2022 at 14:11:09 UTC, H. S. Teoh wrote: > > On Fri, Aug 05, 2022 at 01:56:40PM +, Ruby The Roobster via > > Digitalmars-d-learn wrote: [...] > > > public import dutils.math.core; >

Re: Arbitrary precision decimal numbers

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 14:11:10 UTC, frame wrote: On Friday, 5 August 2022 at 14:03:36 UTC, Ruby The Roobster wrote: Also, what about division and exponentiation. You can't just forward them to BigInt and get a good result, BigInt will just round to an integer for these two. There

Re: Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 14:11:09 UTC, H. S. Teoh wrote: On Fri, Aug 05, 2022 at 01:56:40PM +, Ruby The Roobster via Digitalmars-d-learn wrote: [...] public import dutils.math.core; Is the imported module available anywhere? I'm trying to run your code sample to determine what's

Re: Arbitrary precision decimal numbers

2022-08-05 Thread frame via Digitalmars-d-learn
On Friday, 5 August 2022 at 14:03:36 UTC, Ruby The Roobster wrote: Also, what about division and exponentiation. You can't just forward them to BigInt and get a good result, BigInt will just round to an integer for these two. There are divMod() and powmod() for BigInt but I have no idea how

Re: Obscure Isssue #1

2022-08-05 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Aug 05, 2022 at 01:56:40PM +, Ruby The Roobster via Digitalmars-d-learn wrote: [...] > public import dutils.math.core; Is the imported module available anywhere? I'm trying to run your code sample to determine what's going on, but it's not compiling because you didn't post the code

Re: Arbitrary precision decimal numbers

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
On Friday, 5 August 2022 at 14:00:32 UTC, frame wrote: On Thursday, 4 August 2022 at 13:01:30 UTC, Ruby The Roobster wrote: Is there any implementation in phobos of something similar to BigInt but for non-integers as well? If there isn't is there a dub package that does this, and if so, which

Re: Arbitrary precision decimal numbers

2022-08-05 Thread frame via Digitalmars-d-learn
On Thursday, 4 August 2022 at 13:01:30 UTC, Ruby The Roobster wrote: Is there any implementation in phobos of something similar to BigInt but for non-integers as well? If there isn't is there a dub package that does this, and if so, which one? We have this:

Obscure Isssue #1

2022-08-05 Thread Ruby The Roobster via Digitalmars-d-learn
My code (as seen below) is failing due to a single line. That line is: ```d this.ival += (this.val * rhs.ival); ``` I kid you not, this is the reason why running unittests results in a program that just hangs. And no, replacing unittest with void main() doesn't fix the problem. ```d module

Re: code review: splitIds from DConf '22 day 3: saving a sort and "getting performance"

2022-08-05 Thread user1234 via Digitalmars-d-learn
On Thursday, 4 August 2022 at 13:18:40 UTC, kdevel wrote: At DConf '22 day 3 Robert Schadek presented at around 07:22:00 in the YT video the function `splitIds`. Given an HTML page from bugzilla containing a list of issues `splitIds` aims at extracting all bug-ids referenced within a specific

Re: curses/ncurses liberary in D

2022-08-05 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 5 August 2022 at 04:14:22 UTC, H. S. Teoh wrote: including cursorX, cursorY Worth noting these are not initialized in linear mode, only in fullscreen/cellular. I might change that soon, it is on my todo list. (Granted, though, the main page could be expanded to include examples

Re: Ranges

2022-08-05 Thread frame via Digitalmars-d-learn
On Thursday, 4 August 2022 at 22:14:26 UTC, Ali Çehreli wrote: No element is copied or moved. :) Ali I know that :) I just found that this user has problems to understand basics in D, so I tried not to go in detail and keep at its kind of logical layer. It seems the better way to help