Re: Performance of tables slower than built in?

2019-05-21 Thread matheus via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 00:55:37 UTC, Adam D. Ruppe wrote: On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: I am trying to create some fast sin, sinc, and exponential routines to speed up some code by using tables... but it seems it's slower than the function itself?!? There's

Re: Performance of tables slower than built in?

2019-05-21 Thread rikki cattermole via Digitalmars-d-learn
On 22/05/2019 12:22 PM, JS wrote: I am trying to create some fast sin, sinc, and exponential routines to speed up some code by using tables... but it seems it's slower than the function itself?!? The code below uses matplotlibd but is not necessary. The timing code is lower. Ideally I'd

Re: Performance of tables slower than built in?

2019-05-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 22 May 2019 at 00:22:09 UTC, JS wrote: I am trying to create some fast sin, sinc, and exponential routines to speed up some code by using tables... but it seems it's slower than the function itself?!? There's intrinsic cpu instructions for some of those that can do the math

Re: dmd -nodefaultlibs?

2019-05-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 21:48:22 UTC, Jonathan Marler wrote: Is there a way to prevent dmd from adding any default libraries to its linker command? dmd -defaultlib= yourfile.d Note it is = then nothing; you set it to a null library. Then it will not link any D library. that takes the D

Performance of tables slower than built in?

2019-05-21 Thread JS via Digitalmars-d-learn
I am trying to create some fast sin, sinc, and exponential routines to speed up some code by using tables... but it seems it's slower than the function itself?!? The code below uses matplotlibd but is not necessary. The timing code is lower. Ideally I'd like to have quadratic interpolation

Re: Tweakig -lowmem to be more eager

2019-05-21 Thread Anonymouse via Digitalmars-d-learn
On Monday, 20 May 2019 at 13:41:15 UTC, Boris-Barboris wrote: On Sunday, 19 May 2019 at 23:54:27 UTC, Anonymouse wrote: What makes it decide to collect? What triggers it? You can try setting heapSizeFactor option to something lower than 2 to increase collection frequency:

Re: dmd -nodefaultlibs?

2019-05-21 Thread Max Haughton via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 21:48:22 UTC, Jonathan Marler wrote: Is there a way to prevent dmd from adding any default libraries to its linker command? Something equivalent to "-nodefaultlibs" from gcc? https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html I'd still like to use the dmd.conf

Re: Explicitly avoid GC of objects?

2019-05-21 Thread Johan Engelen via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 13:23:54 UTC, Benjamin Schaaf wrote: On Tuesday, 21 May 2019 at 11:54:08 UTC, Robert M. Münch wrote: Is there a trick to accomplish 2 when objects are created from different scopes which need to be kept? So, I have one function creating the objects and one using

dmd -nodefaultlibs?

2019-05-21 Thread Jonathan Marler via Digitalmars-d-learn
Is there a way to prevent dmd from adding any default libraries to its linker command? Something equivalent to "-nodefaultlibs" from gcc? https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html I'd still like to use the dmd.conf file, so I don't want to use "-conf="

Re: Does slicing have an effect?

2019-05-21 Thread rikki cattermole via Digitalmars-d-learn
On 22/05/2019 8:31 AM, Dennis wrote: I was replacing a memcpy with a slice assignment and accidentally used == instead of =. Usually the compiler protects me from mistakes like that: ``` int[4] a; a == a; ``` Error: a == a has no effect However, because I was using slices it didn't: ```

Does slicing have an effect?

2019-05-21 Thread Dennis via Digitalmars-d-learn
I was replacing a memcpy with a slice assignment and accidentally used == instead of =. Usually the compiler protects me from mistakes like that: ``` int[4] a; a == a; ``` Error: a == a has no effect However, because I was using slices it didn't: ``` int[4] a; a[] == a[]; ``` No errors Does

Re: Bitfields

2019-05-21 Thread Era Scarecrow via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 17:16:05 UTC, Russel Winder wrote: As far as I can see std.bitmanip only caters for 8, 16, 32, and 64 bit long bitfields. I worked on/with bitfields in the past, the limit sizes is more or less for natural int types that D supports. However this limitation is

Re: Bitfields

2019-05-21 Thread Boris-Barboris via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 17:16:05 UTC, Russel Winder wrote: Hi, Has anyone used D to work with arbitrary length bitfields with multiple occurences of a sub-bitfield. I am working with DVB Sections and EIT packets are defined as bitfields with loops in them and the header is 112 bits. The

Bitfields

2019-05-21 Thread Russel Winder via Digitalmars-d-learn
Hi, Has anyone used D to work with arbitrary length bitfields with multiple occurences of a sub-bitfield. I am working with DVB Sections and EIT packets are defined as bitfields with loops in them and the header is 112 bits. The loops are handleable with subfields obviously, assuming you can work

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 12:51:41 UTC, Adam D. Ruppe wrote: On Tuesday, 21 May 2019 at 07:16:29 UTC, Boqsc wrote: I'm getting unsure why executeShell works on the pause command, but cls that is responsible for clearing the text do not. When you ran pause, did it print the text "press any

Re: Explicitly avoid GC of objects?

2019-05-21 Thread Benjamin Schaaf via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 11:54:08 UTC, Robert M. Münch wrote: Is there a trick to accomplish 2 when objects are created from different scopes which need to be kept? So, I have one function creating the objects and one using them. How can I keep things on the stack between these two

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:16:29 UTC, Boqsc wrote: I'm getting unsure why executeShell works on the pause command, but cls that is responsible for clearing the text do not. When you ran pause, did it print the text "press any key to continue"? executeShell captures the output of the

Re: release build with debug information?

2019-05-21 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 09:48:34 UTC, Robert M. Münch wrote: Is it possible to compile a release build with debug information? with plain dmd dmd -g -release -O or dmd -g -release -debug -O The -g is debug info. The -debug switch turns on `debug` code blocks. -O turns on

Explicitly avoid GC of objects?

2019-05-21 Thread Robert M. Münch via Digitalmars-d-learn
The D docs for interfacing with C state: If pointers to D garbage collector allocated memory are passed to C functions, it's critical to ensure that that memory will not be collected by the garbage collector before the C function is done with it. This is accomplished by: 1. Making a copy of

Re: release build with debug information?

2019-05-21 Thread Alex via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 09:48:34 UTC, Robert M. Münch wrote: Is it possible to compile a release build with debug information? There is a "release-debug" version in case you are using dub. Not sure, if there is enough debug info for you.

Re: Meson build system user learning D.

2019-05-21 Thread Russel Winder via Digitalmars-d-learn
On Tue, 2019-05-21 at 05:21 +, Mike Brockus via Digitalmars-d-learn wrote: > […] > The solution from Reddit solves the problem for 'dub' but as part > of my project C to D I wanted to use Meson and run test with > whatever is available, coming next week I will try to incorporate >

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread BoQsc via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 10:03:38 UTC, KnightMare wrote: try next: spawnShell( "cls" ).wait; Wow, spawnShell indeed does the job as I would expect, as of right now. Thanks. spawnShell Function indeed sounds like it would spawn a new shell instead of what it does, at first I didn't look

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread KnightMare via Digitalmars-d-learn
try next: spawnShell( "cls" ).wait;

Blog Post #0037 - File Dialog II - Open Multiple Files

2019-05-21 Thread Ron Tarrant via Digitalmars-d-learn
Tuesday creeps up on us again and it's time for another blog post. Today's instalment continues from last time with a multi-select file dialog. You can find it here: http://gtkdcoding.com/2019/05/21/0037-file-open-multiple.html

release build with debug information?

2019-05-21 Thread Robert M. Münch via Digitalmars-d-learn
Is it possible to compile a release build with debug information? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Re: How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:16:29 UTC, Boqsc wrote: I'm getting unsure why executeShell works on the pause command, but cls that is responsible for clearing the text do not. import std.stdio, std.process; void main() { writeln("Some text that will appear in cmd");

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:33:17 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:19:38 UTC, Marco de Wild wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread rumbu via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:16:49 UTC, Jim wrote: On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base isn't implementing FeatureX, but foo is really a Foo

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Daniel Kozak via Digitalmars-d-learn
On Tue, May 21, 2019 at 7:55 AM Jim via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Hi, > > Question: How to call foo.x in @safe code ? > @safe: interface Base { void setup(); } interface FeatureX { void x(); } interface FeatureY { void y(); } class Foo: Base,

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Marco de Wild via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo = new Foo(); // This would be the result of a factory class

How to "Clear the Screen" for Windows Command Processor? (Windows 10)

2019-05-21 Thread Boqsc via Digitalmars-d-learn
I'm getting unsure why executeShell works on the pause command, but cls that is responsible for clearing the text do not. import std.stdio, std.process; void main() { writeln("Some text that will appear in cmd"); executeShell("cls"); // Does not clear the text?

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread Jim via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 07:04:27 UTC, rumbu wrote: On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: That's because foo is of type Base, not implementing FeatureX. Right, Base isn't implementing FeatureX, but foo is really a Foo which does: class Foo: Base, FeatureX { void

Re: Casting to interface not allowed in @safe code?

2019-05-21 Thread rumbu via Digitalmars-d-learn
On Tuesday, 21 May 2019 at 05:51:30 UTC, Jim wrote: Hi, consider this: interface Base { void setup(); } interface FeatureX { void x(); } class Foo: Base, FeatureX { void setup(){}; void x(){}; } void main() { Base foo = new Foo(); // This would be the result of a factory class

Re: Framework design, initialization and framework usage

2019-05-21 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-20 19:26:38 +, kdevel said: Open a new document in MS Word or any other word processor and then press and hold the "L" key until the cursor hits the right margin. What do you see? Evenly spaced els? The layout stuff we do is not meant to handle text layouting. That will be