Hello everyone,

I have a function:
void foo(T *t) { ... }

void bar(...) {
    T *t = ...;

In the debugger, before calling 'foo', 't' had a value (an address) let's say 10. Stepping into 'foo', the 't' that 'foo' got, which is supposed to have the same value that the 't' in 'bar' had, actually had a completely different value. That caused a very bad bug...

I thought that D behaves in that kind of situations as C/C++, and so I thought 'foo' should get the same value but that was not true. Needless to say it took a lot of time to notice it
as I would never expect it and I still don't know how to fix it.
How does this happen? Is there are some specifics about pointers and / or passing arguments that I should know?

What is also puzzling is that the project is about 4500 lines of D code _full_ of pointers and this happens in all calls I have checked and _somehow_ it was working up until now.

Best regards,
Stefanos Baziotis

Reply via email to