Dynamic Arrays Capacity

2022-06-01 Thread Salih Dincer via Digitalmars-d-learn
Hi, Do I misunderstand? A dynamic array is allocated memory according to the `nextpow2()` algorithm(-1 lapse); strings, on the other hand, don't behave like this... ```d string str = "0123456789ABCDEF"; char[] chr = str.dup; assert(str.length == 16); assert(str.capacity == 0);

Re: Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Tejas via Digitalmars-d-learn
On Thursday, 2 June 2022 at 01:49:32 UTC, Ruby The Roobster wrote: On Thursday, 2 June 2022 at 01:29:39 UTC, Ruby The Roobster wrote: On Thursday, 2 June 2022 at 01:00:57 UTC, Ali Çehreli wrote: On 6/1/22 17:36, Ruby The Roobster wrote: > A stripped down version of some code I have: Not much

Graphing a D function : possible?

2022-06-01 Thread z via Digitalmars-d-learn
Is there a quick way of obtaining the graph of D functions like these? ```d T f(T) if (isScalarType!T){} ``` or ```D T[2] f(T, T)if (isScalarType!T){} ``` I know that there are graphing calculators already, but these don't support low level black magic like int <-> float conversions and i'm

Re: Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 2 June 2022 at 01:29:39 UTC, Ruby The Roobster wrote: On Thursday, 2 June 2022 at 01:00:57 UTC, Ali Çehreli wrote: On 6/1/22 17:36, Ruby The Roobster wrote: > A stripped down version of some code I have: Not much experience here but I made two changes: 1) Added 'shared': >

Re: Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 2 June 2022 at 01:00:57 UTC, Ali Çehreli wrote: On 6/1/22 17:36, Ruby The Roobster wrote: > A stripped down version of some code I have: Not much experience here but I made two changes: 1) Added 'shared': > this(Complex!real num = Complex!real(0,0)) shared > { >

Re: Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Ali Çehreli via Digitalmars-d-learn
On 6/1/22 17:36, Ruby The Roobster wrote: > A stripped down version of some code I have: Not much experience here but I made two changes: 1) Added 'shared': > this(Complex!real num = Complex!real(0,0)) shared > { > this.num = num; > } >

Anybody have any idea on how to do shared operator overloads?

2022-06-01 Thread Ruby The Roobster via Digitalmars-d-learn
A stripped down version of some code I have: ```d public import std.complex; public interface Mtype { // ... } public class Number : Mtype { public: this(Complex!real num = Complex!real(0,0)) { this.num = num; } this(shared Complex!real num =

Re: Basic SQLite Application

2022-06-01 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 1 June 2022 at 15:40:43 UTC, harakim wrote: It's been a long time since I did any C development, and I have never done any on windows, but I thought I could statically link to the .lib at compile time and then I wouldn't need a dll. You sometimes can, it depends on how the

Re: Basic SQLite Application

2022-06-01 Thread harakim via Digitalmars-d-learn
On Wednesday, 1 June 2022 at 15:58:01 UTC, Jesse Phillips wrote: On Wednesday, 1 June 2022 at 15:40:43 UTC, harakim wrote: It's been a long time since I did any C development, and I have never done any on windows, but I thought I could statically link to the .lib at compile time and then I

Re: Basic SQLite Application

2022-06-01 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 1 June 2022 at 15:40:43 UTC, harakim wrote: It's been a long time since I did any C development, and I have never done any on windows, but I thought I could statically link to the .lib at compile time and then I wouldn't need a dll. I'm fine with using a dll, but I don't know how

Re: Basic SQLite Application

2022-06-01 Thread harakim via Digitalmars-d-learn
On Wednesday, 1 June 2022 at 10:57:11 UTC, Adam D Ruppe wrote: BTW: "copyFiles":["lib/sqlite3.lib"] You don't need that, the .lib is only used while building. You might need to copyFiles the .dll though. It's been a long time since I did any C development, and I have never done

Re: freebsd dub linker error

2022-06-01 Thread Kagamin via Digitalmars-d-learn
Try to run clang with -v option and compare with gcc.

Re: freebsd dub linker error

2022-06-01 Thread Alain De Vos via Digitalmars-d-learn
The detailed error is : ``` /usr/bin/clang test.o -o test -L/usr/local/lib -lphobos2-ldc -ldruntime-ldc -Wl,--gc-sections -lexecinfo -lpthread -lm -m64 ld: error: undefined hidden symbol: __start___minfo referenced by test.d test.o:(ldc.register_dso) ```

Re: freebsd dub linker error

2022-06-01 Thread Alain De Vos via Digitalmars-d-learn
Performed additional tests. Compiling helloworld.d ``` export CC=gcc11 ; ldc2 helloworld.d ``` works fine. Compiling helloworld.d ``` export CC=clang ; ldc2 helloworld.d ``` returns: ``` d: error: undefined hidden symbol: __start___minfo referenced by test.d

Re: Basic SQLite Application

2022-06-01 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 1 June 2022 at 03:46:38 UTC, harakim wrote: I started trying to get it to compile in another directory structure but since I've switched to dub It should work the way you have it, just with dub you can also the dub version instead of copying the files: