Re: String concatenation segmentation error

2021-04-22 Thread tcak via Digitalmars-d-learn
l, all of them cause segmentation fault with error: _D2gc4impl12conservativeQw3Gcx10smallAllocMFNbmKmkxC8TypeInfoZPv () When I comment out those piece of codes, there is no error. If there is no known situation that would cause this, I will need to update codes to C-style pre-allocate buffer and cop

Re: String concatenation segmentation error

2021-04-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 22 April 2021 at 21:15:48 UTC, tcak wrote: "positions" array is defined as auto positions = new float[ 100 ]; So, I am 100% sure, it is not out of range. "ri*dim + 1" is not a big number at all. Oh and *where* is that positions variable defined?

Re: String concatenation segmentation error

2021-04-22 Thread Adam D. Ruppe via Digitalmars-d-learn
Are there any other threads in your program?

Re: String concatenation segmentation error

2021-04-22 Thread tcak via Digitalmars-d-learn
In other parts of the code, concatenation operations are all failing with same error. I need guidance to get out of this situation. My assumption was that as long as there is empty heap memory, concatenation operation would succeed always. But, it doesn't seem like so.

String concatenation segmentation error

2021-04-22 Thread tcak via Digitalmars-d-learn
ll allocation. I remember I had this problem before in another project. I have enough free ram. htop shows 3.96 GiB of 8 GiB is used only and swap is not in use. DMD64 D Compiler v2.094.0 Is this error related to me? Is it a programmer error? Is it a bug? Am I doing something wrong? This is a compiler related operation (string concatenation), and I assume/expect that it would work without a problem.

Re: DUB Error with packcage dformlib

2021-04-18 Thread Alain De Vos via Digitalmars-d-learn
For some weird reason , https://code.dlang.org Has lots of packages without maintainer ... Git repositories which are put read-only ... I.e. no "Issues"

Re: DUB Error with packcage dformlib

2021-04-18 Thread Marcone via Digitalmars-d-learn
On Sunday, 18 April 2021 at 07:31:12 UTC, Imperatorn wrote: On Sunday, 18 April 2021 at 01:37:14 UTC, Marcone wrote: I have this message when try build dub. How solve it? Unresolvable dependencies to package dformlib app ~master depends on dformlib ~0.2.2> Just a comment, dforms is millions

Re: DUB Error with packcage dformlib

2021-04-18 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 18 April 2021 at 01:37:14 UTC, Marcone wrote: I have this message when try build dub. How solve it? Unresolvable dependencies to package dformlib app ~master depends on dformlib ~0.2.2> Just a comment, dforms is millions of years old. It would be nice to see support for it again,

Re: DUB Error with packcage dformlib

2021-04-17 Thread Alain De Vos via Digitalmars-d-learn
It might be a dead monkey. You could try: https://github.com/o3o/dguihub

DUB Error with packcage dformlib

2021-04-17 Thread Marcone via Digitalmars-d-learn
I have this message when try build dub. How solve it? Unresolvable dependencies to package dformlib app ~master depends on dformlib ~0.2.2>

Re: Range Error

2021-04-15 Thread martinm via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:48:42 UTC, Ruby The Roobster wrote: On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 19:19:12 UTC, kdevel wrote: On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote: [...] [...] D can be so much fun! ```d import std.stdio; [...] Of course :D

Re: Range Error

2021-04-12 Thread kdevel via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote: [...] Yup D can be so much fun! ```d import std.stdio; enum Color {none = " n ", red = " r ", black = " b "}; enum sColor {black= " b ", white= " w "}; class Square { public: this(Color color, sColor Scolor) { this.color

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:01:02 UTC, kdevel wrote: On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: [...] [...] Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as

Re: Range Error

2021-04-12 Thread kdevel via Digitalmars-d-learn
On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: [...] What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
: ```d   for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i < 0`. ... I fixed the code now. It works. Thanks for your help.

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
go on forever, so you get a range error as soon as `i < 0`. —Bastiaan. I have fixed this.

Re: Range Error

2021-04-11 Thread Steven Schveighoffer via Digitalmars-d-learn
get a range error as soon as `i < 0`. Also this code is wrong: ```d for(int i=2;i>=0;i--) { for(int j=7;i>=0;j--) ``` For that j loop, i will always be 2, so it will not terminate until the range error happens. Should probably be: for(int j=7; j >= 0; j--) I wou

Re: Range Error

2021-04-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i &

Re: Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new Square(Color.none, sColor.white); ```

Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
So, here is the full code: ```d enum Color {none=0,red=1,black=2}; enum sColor {black=0,white=1}; class Square { public: this(Color color, sColor Scolor) { this.color = color; this.Scolor = Scolor; } Color color; sColor Scolor; } import std.stdio; void

Error when running dmd compilable tests

2021-04-11 Thread Per Nordlöw via Digitalmars-d-learn
Inside dmd source tree, under sub-directory test, I do ./run.d compilable/ . This errors as ``` ... compilable/json.d -d -preview=dip1000 -o- -X -Xf/home/per/Work/dmd/test/test_results/compilable/json.out -fPIC ()== Test 'compilable/json.d'

Re: Strange error

2021-03-23 Thread Nicholas Wilson via Digitalmars-d-learn
On Monday, 22 March 2021 at 07:52:14 UTC, MichaelJames wrote: Tell me, did you manage to solve this problem? https://github.com/dlang/dmd/pull/12300

Re: Strange error

2021-03-22 Thread MichaelJames via Digitalmars-d-learn
(); // Error: expression __lambda1 is not a valid template value argument smpl.func2(); // Error: expression __lambda2 is not a valid template value argument } void main(){ enum s = Sample( {writeln("Hello world1");}, {writeln("Hello world2");} ); s.func1();

Re: Strange error

2021-03-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/21/21 3:18 AM, Jack Applegame wrote: Could someone please explain what is wrong with this code? https://glot.io/snippets/fwxn2198kv ```d import std.stdio; struct Sample{   void function() func1;   void function() func2; } void noth(Sample smpl)() {   smpl.func1(); // Error

Re: Strange error

2021-03-21 Thread Jack Applegame via Digitalmars-d-learn
function() func2; } void noth(Sample smpl)() { smpl.func1(); // Error: expression __lambda1 is not a valid template value argument smpl.func2(); // Error: expression __lambda2 is not a valid template value argument } void main(){ enum s = Sample( {writeln("Hello world1");},

Re: Strange error

2021-03-21 Thread Imperatorn via Digitalmars-d-learn
(); // Error: expression __lambda1 is not a valid template value argument smpl.func2(); // Error: expression __lambda2 is not a valid template value argument } void main(){ enum s = Sample( {writeln("Hello world1");}, {writeln("Hello world2");} ); s.func1();

Strange error

2021-03-21 Thread Jack Applegame via Digitalmars-d-learn
Could someone please explain what is wrong with this code? https://glot.io/snippets/fwxn2198kv ```d import std.stdio; struct Sample{ void function() func1; void function() func2; } void noth(Sample smpl)() { smpl.func1(); // Error: expression __lambda1 is not a valid template value

Re: Using YMM registers causes an undefined label error

2021-03-19 Thread z via Digitalmars-d-learn
On Tuesday, 9 March 2021 at 20:33:01 UTC, z wrote: On Tuesday, 9 March 2021 at 20:23:48 UTC, z wrote: On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: ... Then it seems the only way to get AVX-compatible inline assembly(ldc.llvmasm excluded) is to use an external assembler. For example :

Re: Very confusing error message when calling a class method from an invariant

2021-03-09 Thread Meta via Digitalmars-d-learn
On Wednesday, 10 March 2021 at 04:57:19 UTC, Paul Backus wrote: On Wednesday, 10 March 2021 at 03:39:15 UTC, Meta wrote: class Human { static immutable MAX_AGE = 122; bool alive = true; int age = 0; //Error: mutable method onlineapp.Human.checkAge is not callable using a const

Re: Very confusing error message when calling a class method from an invariant

2021-03-09 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 10 March 2021 at 03:39:15 UTC, Meta wrote: class Human { static immutable MAX_AGE = 122; bool alive = true; int age = 0; //Error: mutable method onlineapp.Human.checkAge is not callable using a const object invariant(checkAge()); [...] What the hell does

Very confusing error message when calling a class method from an invariant

2021-03-09 Thread Meta via Digitalmars-d-learn
class Human { static immutable MAX_AGE = 122; bool alive = true; int age = 0; //Error: mutable method onlineapp.Human.checkAge is not callable using a const object invariant(checkAge()); void growOlder() in(alive) out(; checkAge()) { age

Re: Using YMM registers causes an undefined label error

2021-03-09 Thread z via Digitalmars-d-learn
On Tuesday, 9 March 2021 at 20:23:48 UTC, z wrote: On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: ... Then it seems the only way to get AVX-compatible inline assembly(ldc.llvmasm excluded) is to use an external assembler. For example : ... But i'm not really sure how to integrate that

Re: Using YMM registers causes an undefined label error

2021-03-09 Thread z via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: ... Then it seems the only way to get AVX-compatible inline assembly(ldc.llvmasm excluded) is to use an external assembler. For example : import std.stdio; extern(C) void vxorps_d(ubyte[32]*); void main() { ubyte[32] a = 2;

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kdevel via Digitalmars-d-learn
On Sunday, 7 March 2021 at 12:47:45 UTC, kinke wrote: [...] ./dmd -i -of=pointless.o -g -c pointless/package.d "dmd" is a symlink to /opt/ldc2/bin/ldmd2 Ah, try using `-i=-ldc` instead of `-i` alone to manually exclude the ldc.* modules from being included. Solved the issue. Many thanks!

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kinke via Digitalmars-d-learn
On Sunday, 7 March 2021 at 11:34:08 UTC, kdevel wrote: ./dmd -i -I=tillyscop:tillyscop/msgpack-d/src -O -g -of=localscop.o -c tillyscop/scop.d tillyscop/scopserializer.d and ./dmd -i -of=pointless.o -g -c pointless/package.d "dmd" is a symlink to /opt/ldc2/bin/ldmd2 Ah, try using `-i=-ldc`

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kdevel via Digitalmars-d-learn
On Sunday, 7 March 2021 at 11:50:45 UTC, z wrote: [...] I think i had a similar error, can you try adding version(LDC) pragma(LDC_no_moduleinfo) to the affected modules? At the line just after the module declaration, particularly in all package.d files and the file that contains the main

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread z via Digitalmars-d-learn
but ideally I want to reuse my Makefile). I think i had a similar error, can you try adding version(LDC) pragma(LDC_no_moduleinfo) to the affected modules? At the line just after the module declaration, particularly in all package.d files and the file that contains the main function. However, your

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-07 Thread kdevel via Digitalmars-d-learn
On Sunday, 7 March 2021 at 01:29:50 UTC, Preetpal wrote: [...] Can you post more information? Like the full error that you are seeing, [link cmd] /usr/bin/ld.gold: error: pointless.o: multiple definition of '_D3ldc10attributes10assumeUsedySQBeQBd11_assumeUsed' /usr/bin/ld.gold: localscop.o

Re: dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-06 Thread Preetpal via Digitalmars-d-learn
but ideally I want to reuse my Makefile). Can you post more information? Like the full error that you are seeing, the command you are forced to use to allow everything to compile, the platform that you are on (Mac, BSD, Linux, etc.).

dmd -> ldmd2: /usr/bin/ld.gold: error: .o: multiple definition of 'bool ldc.attributes...

2021-03-06 Thread kdevel via Digitalmars-d-learn
After replacing dmd with ldmd2 (LDC 1.25.1) I get tons of link errors all of the form mentioned in the subject. Any idea what can be done about it? (With a handcrafted single compile/link statement using ldc2 everything compiles but ideally I want to reuse my Makefile).

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Guillaume Piolat via Digitalmars-d-learn
On Saturday, 6 March 2021 at 16:09:03 UTC, Imperatorn wrote: On Saturday, 6 March 2021 at 15:40:56 UTC, Rumbu wrote: On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: [...] Where exactly is documented the extern(D) x86-64 calling convention? Because currently seems like a mess

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 15:40:56 UTC, Rumbu wrote: On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: [...] Where exactly is documented the extern(D) x86-64 calling convention? Because currently seems like a mess according to the dissasembly. First X parameters on stack from

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Rumbu via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:29:07 UTC, kinke wrote: There are other slight breakages of that 'spec', e.g., LDC's extern(D) ABI is very similar to Microsoft's __vectorcall (so that e.g. vectors are passed in registers). [Windows only, to prevent any more confusion.]

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Saturday, 6 March 2021 at 12:15:43 UTC, Mike Parker wrote: On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 6 March 2021 at 11:57:13 UTC, Imperatorn wrote: What... Is this really how it's supposed to be? Makes no sense to not use any of the existing conventions. extern(C) and extern(D) are both documented to be the same as the platform's C calling convention everywhere except x86

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread kinke via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/Iq

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 6 March 2021 at 10:45:08 UTC, Rumbu wrote: On Friday, 5 March 2021 at 21:47:49 UTC, z wrote: [...] I just made some tests, it seems that D has invented his own calling convention. And it's not documented. If you decorate your function with extern(C) it should respect the

Re: Using YMM registers causes an undefined label error

2021-03-06 Thread Rumbu via Digitalmars-d-learn
absolutely right, but apparently it only accepts the two-operand version from SSE. Other AVX/AVX2/AVX512 instructions that have «v» prefixed aren't recognized either("Error: unknown opcode vmovaps"), is AVX(2) with YMM registers supported for «asm{}» statements? I just made some tests

Re: Using YMM registers causes an undefined label error

2021-03-05 Thread z via Digitalmars-d-learn
the two-operand version from SSE. Other AVX/AVX2/AVX512 instructions that have «v» prefixed aren't recognized either("Error: unknown opcode vmovaps"), is AVX(2) with YMM registers supported for «asm{}» statements?

Re: Using YMM registers causes an undefined label error

2021-03-05 Thread Rumbu via Digitalmars-d-learn
On Friday, 5 March 2021 at 12:57:43 UTC, z wrote: XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/IqD

Using YMM registers causes an undefined label error

2021-03-05 Thread z via Digitalmars-d-learn
XMM registers work, but as soon as they are changed into YMM DMD outputs "bad type/size of operands %s" and LDC outputs an "label YMM0 is undefined" error. Are they not supported? To illutrate : https://run.dlang.io/is/IqDHlK By the way, how can i use instructions that a

Re: unittest compiles w/o error though module file is not named after the module

2021-02-06 Thread ag0aep6g via Digitalmars-d-learn
On 06.02.21 16:05, kdevel wrote: On Saturday, 6 February 2021 at 14:52:57 UTC, Adam D. Ruppe wrote: [...] That one `import p;` is kinda weird, it should probably complain then you imported one thing and got another, but generally the name not matching is no problem at all. ```main.d

Re: unittest compiles w/o error though module file is not named after the module

2021-02-06 Thread kdevel via Digitalmars-d-learn
On Saturday, 6 February 2021 at 14:52:57 UTC, Adam D. Ruppe wrote: [...] That one `import p;` is kinda weird, it should probably complain then you imported one thing and got another, but generally the name not matching is no problem at all. ```main.d (version 2) // import x; unittest { //

Re: unittest compiles w/o error though module file is not named after the module

2021-02-06 Thread Adam D. Ruppe via Digitalmars-d-learn
Module names and file names are completely independent on the language level. You can have a file `whatever.d` with `module foo.bar.totally.different;` and `import foo.bar.totally.different` and it all works as long as you add the whatever.d to the build. The only reason people recommend

unittest compiles w/o error though module file is not named after the module

2021-02-06 Thread kdevel via Digitalmars-d-learn
() 1 unittests passed Came across this while doing a comprehensive file renaming in a package. I usually let me guide thru the codebase by the compile error messages. However, make test unexpectedly succeeded though I have not yet adapted all import directives. Of course I could use git grep

Re: Why am I getting a dividing by zero error message

2021-01-28 Thread tsbockman via Digitalmars-d-learn
vides by `data[1].y`. Since you set that field equal to 0 in step (1), and both operands have type `uint`, the result is a divide by zero error. 4) Also, `if(tempb < 0) tempb-=tempb;` will convert any negative values into zeroes. Maybe you meant to write `if(tempb < 0) tempb = -t

Re: Why am I getting a dividing by zero error message

2021-01-28 Thread Ruby The Roobster via Digitalmars-d-learn
] = (new egg(0,0,"a")); Here you set data[0].y to 0 tempb = data[x].y; In the first iteration, this equals data[0].y which equals 0 temp = tempa / tempb; And then you divide by zero here, hence the error Okay. That worked. I added a check to set temp to zero if tempa or tem

Re: Why am I getting a dividing by zero error message

2021-01-28 Thread Ruby The Roobster via Digitalmars-d-learn
b = data[x].y; In the first iteration, this equals data[0].y which equals 0 temp = tempa / tempb; And then you divide by zero here, hence the error Okay. That worked. I added a check to set temp to zero if tempa or tempb is zero.

Re: Why am I getting a dividing by zero error message

2021-01-28 Thread evilrat via Digitalmars-d-learn
tempa-=tempa; tempb = data[x].y; if(tempb < 0) tempb-=tempb; /* x starts with 0, you are acessing data[x] which is set to egg(0,0,"a") and you get div by zero as a result. I see logic error, though I might be wrong because I

Re: Why am I getting a dividing by zero error message

2021-01-28 Thread jmh530 via Digitalmars-d-learn
On Thursday, 28 January 2021 at 18:37:37 UTC, Ruby The Roobster wrote: Here is the output/input of the program: Type in data for an egg: Width: 3 Hight: 2 [...] It might help to separate break this out into smaller functions. May make it easier to follow what is happening.

Re: Why am I getting a dividing by zero error message

2021-01-28 Thread Dennis via Digitalmars-d-learn
0].y which equals 0 temp = tempa / tempb; And then you divide by zero here, hence the error

Why am I getting a dividing by zero error message

2021-01-28 Thread Ruby The Roobster via Digitalmars-d-learn
Here is the output/input of the program: Type in data for an egg: Width: 3 Hight: 2 object.Error@(0): Integer Divide by Zero 0x004023FE 0x0040CF9F 0x0040CF19 0x0040CDB4 0x00409033 0x00402638 0x75F86359 in BaseThreadInitThunk 0x77018944 in RtlGetAppContainerNamedObjectPath

Re: Conversion error.

2021-01-27 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 28 January 2021 at 01:09:52 UTC, Adam D. Ruppe wrote: On Thursday, 28 January 2021 at 01:01:36 UTC, Ruby The Roobster wrote: readf("%d",x); This is why I hate readf, it is sensitive to litte things. If you put a space in that string I think it will fix it. What happens here

Re: Conversion error.

2021-01-27 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 28 January 2021 at 01:01:36 UTC, Ruby The Roobster wrote: readf("%d",x); This is why I hate readf, it is sensitive to litte things. If you put a space in that string I think it will fix it. What happens here is it reads the float, then leaves the buffer at the \n from when

Conversion error.

2021-01-27 Thread Ruby The Roobster via Digitalmars-d-learn
I don't know any explanation for the following error: std.conv.ConvException@D:\Programs\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2437): Unexpected '\n' when converting from type LockingTextReader to type int Here is my code for reference: module main; import std.stdio; import

Re: Conversion error.

2021-01-27 Thread Ruby The Roobster via Digitalmars-d-learn
On Thursday, 28 January 2021 at 01:01:36 UTC, Ruby The Roobster wrote: I don't know any explanation for the following error: std.conv.ConvException@D:\Programs\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2437): Unexpected '\n' when converting from type LockingTextReader to type int

Re: closures + struct: Error: forward reference to inferred return type of function call

2020-12-15 Thread ddcovery via Digitalmars-d-learn
actorial = (int n) => n==0 ? 1 : n * factorial(n-1); *factorial* is not defined yet when compiler analyzes lambda expression. This is something to keep in mind for people coming from python/javascript languajes. Sometimes I forget D is not an scripting/dynamic one (note: crystal has the s

Re: closures + struct: Error: forward reference to inferred return type of function call

2020-12-15 Thread Q. Schroll via Digitalmars-d-learn
On Monday, 14 December 2020 at 14:39:14 UTC, ddcovery wrote: On Monday, 14 December 2020 at 12:22:26 UTC, ddcovery wrote: int opCmp(Number other){ return _value - other.value; }; Correction: bool opEquals(Number other){ return _value == other.value; }; You could just give

Re: closures + struct: Error: forward reference to inferred return type of function call

2020-12-14 Thread ddcovery via Digitalmars-d-learn
On Monday, 14 December 2020 at 12:22:26 UTC, ddcovery wrote: int opCmp(Number other){ return _value - other.value; }; Correction: bool opEquals(Number other){ return _value == other.value; };

closures + struct: Error: forward reference to inferred return type of function call

2020-12-14 Thread ddcovery via Digitalmars-d-learn
function and compiler doesn't accept it: main.d(16): Error: forward reference to inferred return type of function call number(_value + 1) main.d(19): Error: forward reference to inferred return type of function call number(_value - 1) I know there is another ways to solve this problem easily

Re: Undefined reference error at linktime with unittests

2020-12-10 Thread z via Digitalmars-d-learn
"undefined symbol : mainCRTStartup" error when these problems occur. Hence the confusion.

Re: Undefined reference error at linktime with unittests

2020-12-10 Thread ag0aep6g via Digitalmars-d-learn
On 10.12.20 13:28, z wrote: When compiling with unit tests(via «dub test», or adding «dflags "-unittest"»), i'm getting this error at link time : lld-link: error: undefined symbol: _D5packagename9subpackage9__mixin119type8toStringMFZAya The same occurs with OPTLINK. Curiousl

Undefined reference error at linktime with unittests

2020-12-10 Thread z via Digitalmars-d-learn
When compiling with unit tests(via «dub test», or adding «dflags "-unittest"»), i'm getting this error at link time : lld-link: error: undefined symbol: _D5packagename9subpackage9__mixin119type8toStringMFZAya The same occurs with OPTLINK. Curiously, looking at the incriminated

Re: Is this a compiler error? "recursive template expansion"

2020-12-08 Thread Nathan S. via Digitalmars-d-learn
On Tuesday, 8 December 2020 at 22:01:52 UTC, Basile B. wrote: On Tuesday, 8 December 2020 at 20:11:40 UTC, Nathan S. wrote: The following code fails to compile. Is this a compiler error or if not what is wrong with the code? What is wrong is that partial specialization is not correct

Re: Is this a compiler error? "recursive template expansion"

2020-12-08 Thread Basile B. via Digitalmars-d-learn
On Tuesday, 8 December 2020 at 20:11:40 UTC, Nathan S. wrote: The following code fails to compile. Is this a compiler error or if not what is wrong with the code? What is wrong is that partial specialization is not correct. The correct partial specialization is: --- struct Template2(T

Is this a compiler error? "recursive template expansion"

2020-12-08 Thread Nathan S. via Digitalmars-d-learn
The following code fails to compile. Is this a compiler error or if not what is wrong with the code? --- struct Template2(T) { // If both of the following are removed compilation succeeds // without any other changes: enum tString = T.stringof; static if (is(T == class

Re: how to access record[0] of a csv row? Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

2020-12-07 Thread Paul Backus via Digitalmars-d-learn
On Monday, 7 December 2020 at 06:18:33 UTC, mw wrote: Now, how to convert it to a native array: double[] row = record; Error: cannot implicitly convert expression record of type Tuple!(double, double, double, ..., double) to double[] (I know for tuple, we can do: double[] arr = [record

Re: how to access record[0] of a csv row? Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

2020-12-06 Thread mw via Digitalmars-d-learn
)); Note that N must be a compile-time constant, since the number of elements in a Tuple is fixed at compile time. Yes, I just realized that Tuple (upper T, compile time) and tuple (lower t) are different things. Now, how to convert it to a native array: double[] row = record; Error

Re: how to access record[0] of a csv row? Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

2020-12-06 Thread Paul Backus via Digitalmars-d-learn
On Monday, 7 December 2020 at 04:03:05 UTC, mw wrote: So my next question: given N, how do I create a Tuple!(double, double, ... n-double) type programmatically? import std.meta: Repeat; alias NDoubles = Tuple!(Repeat!(N, double)); Note that N must be a compile-time constant, since the

Re: how to access record[0] of a csv row? Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

2020-12-06 Thread mw via Digitalmars-d-learn
On Monday, 7 December 2020 at 03:51:02 UTC, Paul Backus wrote: On Monday, 7 December 2020 at 02:25:23 UTC, mw wrote: onlineapp.d(8): Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar) should `r`'s type be integer array? and how do I access each elelment

Re: how to access record[0] of a csv row? Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

2020-12-06 Thread Paul Backus via Digitalmars-d-learn
On Monday, 7 December 2020 at 02:25:23 UTC, mw wrote: onlineapp.d(8): Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar) should `r`'s type be integer array? and how do I access each elelment of the row? Thanks. The docs [1] say that csvReader returns

how to access record[0] of a csv row? Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar)

2020-12-06 Thread mw via Digitalmars-d-learn
to records = text.csvReader!int; foreach(r; records) {writeln(r[0]);} // line 8 assert(records.equal!equal([ [76, 26, 22], ])); } but I got a compile error: onlineapp.d(8): Error: no [] operator overload for type CsvRecord!(int, cast(Malformed)1, string, dchar) should `r`'s type

Re: d++: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`:

2020-11-22 Thread Jack via Digitalmars-d-learn
On Sunday, 22 November 2020 at 03:05:45 UTC, kinke wrote: On Saturday, 21 November 2020 at 17:25:46 UTC, Jack wrote: I got the error: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`: Error: unrecognized file extension o dmd version: DMD32 D Compiler v2.094.1-dirty gcc version: gcc

Re: d++: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`:

2020-11-21 Thread kinke via Digitalmars-d-learn
On Saturday, 21 November 2020 at 17:25:46 UTC, Jack wrote: I got the error: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`: Error: unrecognized file extension o dmd version: DMD32 D Compiler v2.094.1-dirty gcc version: gcc version 6.3.0 (MinGW.org GCC-6.3.0-1) DMD expects .obj

Re: d++: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`:

2020-11-21 Thread Jack via Digitalmars-d-learn
://github.com/atilaneves/dpp/tree/master/bash but when I went to run: d++ foo.dpp c.o I got the error: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`: Error: unrecognized file extension o dmd version: DMD32 D Compiler v2.094.1-dirty gcc version: gcc version 6.3.0 (MinGW.org GCC-6.3.0-1

Re: d++: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`:

2020-11-21 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
++ foo.dpp c.o I got the error: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`: Error: unrecognized file extension o dmd version: DMD32 D Compiler v2.094.1-dirty gcc version: gcc version 6.3.0 (MinGW.org GCC-6.3.0-1) d++ the least one, build from sources my OS is windows 10/64-bit. What

d++: Error: Could not execute `dmd c.o .\foo.d -offoo.exe`:

2020-11-21 Thread Jack via Digitalmars-d-learn
I'm trying to get d++ to work on Windows 10/64-bit machine but it doesn't work. I'm using the very same code samples c.c, c.h and foo.dpp from here https://github.com/atilaneves/dpp/tree/master/bash but when I went to run: d++ foo.dpp c.o I got the error: Error: Could not execute `dmd

Re: Unclear error message

2020-11-10 Thread SealabJaster via Digitalmars-d-learn
On Wednesday, 11 November 2020 at 02:05:33 UTC, H. S. Teoh wrote: Definitely. Bad/confusing error messages should always be improved. Please file a bug at: http://issues.dlang.org/ T https://issues.dlang.org/show_bug.cgi?id=21377 I wonder if this is the same as: https

Re: Unclear error message

2020-11-10 Thread H. S. Teoh via Digitalmars-d-learn
main() > { > // OK > auto v = PreValidate(str => str.length == 3); > } > > struct S > { > // ERROR? > @PreValidate(str => str.length == 3) > int a; > } > As I understand the error is caused by trying to provide a delegate > when there's

Re: Unclear error message

2020-11-10 Thread Paul Backus via Digitalmars-d-learn
On Wednesday, 11 November 2020 at 01:05:21 UTC, SealabJaster wrote: Please see the code at https://run.dlang.io/is/Yjidek As I understand the error is caused by trying to provide a delegate when there's no context to provide. Not complaining about that. However what I am complaining about

Unclear error message

2020-11-10 Thread SealabJaster via Digitalmars-d-learn
Please see the code at https://run.dlang.io/is/Yjidek As I understand the error is caused by trying to provide a delegate when there's no context to provide. Not complaining about that. However what I am complaining about is about the error message: `onlineapp.d(31): Error: delegate

Re: Vibe.d build on LDC error

2020-11-06 Thread Vino via Digitalmars-d-learn
On Friday, 6 November 2020 at 10:30:03 UTC, Mathias LANG wrote: On Friday, 6 November 2020 at 05:52:56 UTC, Vino wrote: [...] Which Linux distribution ? Which version of Vibe.d ? A recent enough Vibe.d should detect OpenSSL based on 1) pkg-config 2) the openssl binary. Make sure you have the

Re: Vibe.d build on LDC error

2020-11-06 Thread Mathias LANG via Digitalmars-d-learn
On Friday, 6 November 2020 at 05:52:56 UTC, Vino wrote: Hi All, When we try to build vide.d using ldc (dub build) we are getting the below error, openssl is already been installed (OpenSSL 1.0.2j-fips 26 Sep 2016), hence request your help on the same. openssl.d:84: error: undefined

Vibe.d build on LDC error

2020-11-05 Thread Vino via Digitalmars-d-learn
Hi All, When we try to build vide.d using ldc (dub build) we are getting the below error, openssl is already been installed (OpenSSL 1.0.2j-fips 26 Sep 2016), hence request your help on the same. openssl.d:84: error: undefined reference to 'OPENSSL_init_ssl' openssl.d:121: error

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 15 October 2020 at 14:26:37 UTC, Steven Schveighoffer wrote: On 10/15/20 10:22 AM, Steven Schveighoffer wrote: On 10/15/20 9:55 AM, Andre Pany wrote: I meant this one: https://github.com/vibe-d/eventcore/pull/154 I testing it at the moment, while there still "leaking"

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/15/20 10:22 AM, Steven Schveighoffer wrote: On 10/15/20 9:55 AM, Andre Pany wrote: I meant this one: https://github.com/vibe-d/eventcore/pull/154 I testing it at the moment, while there still "leaking" warnings, the ports are released after terminating the application with Ctrl+c. So

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/15/20 9:55 AM, Andre Pany wrote: I meant this one: https://github.com/vibe-d/eventcore/pull/154 I testing it at the moment, while there still "leaking" warnings, the ports are released after terminating the application with Ctrl+c. So far I was not able to reproduce the issue with

Re: Error on dub build - Trying Vibe-d for the first time

2020-10-15 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 15 October 2020 at 13:17:57 UTC, Steven Schveighoffer wrote: On 10/14/20 2:25 PM, Andre Pany wrote: On Wednesday, 14 October 2020 at 18:08:40 UTC, H. S. Teoh wrote: On Wed, Oct 14, 2020 at 05:30:37PM +, Andre Pany via Digitalmars-d-learn wrote: > > [...] [...] > > [...]

<    1   2   3   4   5   6   7   8   9   10   >