core dumped when run this simple D program.

2024-08-25 Thread Fox via Digitalmars-d-learn
import std.stdio; class myClas_1 { int a; } void main() { myClas_1 c1; writeln(c1.a); } === what's wrong? dmd and gdc both can compile these code, but can't run either. DMD64 D Compiler v2.109.1 gcc 14.2.1 20240824 (GCC) fedora 41 thanks!

Re: core dumped when run this simple D program.

2024-08-26 Thread Fox via Digitalmars-d-learn
On Monday, 26 August 2024 at 07:17:58 UTC, Richard (Rikki) Andrew Cattermole wrote: Classes in D are heap objects, you have to allocate them. ``myClas_1 c1 = new myClas_1;`` The default is null. thank you very much!

Can the send function send an array?

2024-09-10 Thread Fox via Digitalmars-d-learn
// I am learning how to send and receive data. The following is my intention, but it cannot be compiled. // aliases to mutable thread-local data not allowed, what does it mean? thank you. I am learning how to send and receive. The following is my intention, but it cannot be compiled. Report i

Re: Can the send function send an array?

2024-09-10 Thread Fox via Digitalmars-d-learn
OK, It works, thanks. // dlang tries to use the type system to make one be clear about what data is shared between potentially concurrent threads. // You need that data to be "shared" before you can send it between threads. // Andy import std.concurrency; import std.stdio; void main(){

Re: assert

2024-09-11 Thread Fox via Digitalmars-d-learn
I don't care about whether it's a bug or not, I just want to learn What illegal instructions did this "assert(false);" code create?

Re: assert

2024-09-11 Thread Fox via Digitalmars-d-learn
On Wednesday, 11 September 2024 at 16:40:05 UTC, Bradley Chatha wrote: On Wednesday, 11 September 2024 at 12:17:02 UTC, Fox wrote: I don't care about whether it's a bug or not, I just want to learn What illegal instructions did this "assert(false);" code create? Fortunately Godbolt supports