Program crash: GC destroys an object unexpectedly
eugene
dee0xeed at gmail.com
Wed Sep 22 15:47:53 UTC 2021
On Wednesday, 22 September 2021 at 12:26:53 UTC, Steven
Schveighoffer wrote:
> On 9/22/21 8:22 AM, eugene wrote:
>> And it follows that programming in GC-supporting languages
>> *may* be harder than in languages with manual memory
>> management, right?
I meant my this particular trouble...
I do not want to understand how and what
compiler generates, I just want to
get working program without any oddities.
Nevertheless, thank you again for your nice explanation!
> Only when interfacing with C ;) Which admittedly is a stated
> goal for D.
I know.
And this is just fine to have the ability
of using libc (especially system calls) without
such things as c# 'marshaling' for ex.
> It's telling that I've been using D for 14 years and never had
> or seen this problem.
Bond. James Bond. :) 25 years of C coding.
Now, imaging a shock I was under when
I 'discovered' that swapping two lines of code
can magically fix my prog and make GC do
the right thing. :)
Actually, D is a nice language per se
and I truly wish it to be as popular as java/python/etc.
But these GC ... mmm... 'features' may reduce
to zero any wish to learn D, that's about it.
When my C program crashes, I'm 100% sure I made something stupid
- forget to initialize a pointer, easy to find and fix
- did some memory corruption (worse, but then electric fence is
my best friend)
But if a crash is caused by 'optimization' + GC...
It looks like a programmer must keep some
implicit/unwritten rules in order to write correctly...
More information about the Digitalmars-d-learn
mailing list