strange behavior with malloc and free
Johan
j at j.nl
Fri Oct 11 11:43:02 UTC 2019
On Friday, 11 October 2019 at 11:17:04 UTC, Ferhat Kurtulmuş
wrote:
> On Friday, 11 October 2019 at 11:03:32 UTC, Jack Applegame
> wrote:
>> Accessing freed memory leads to undefined behavior.
>
> i agree with you. But, it is interesting for me to face the
> same exact undefined behavior with ldc even on different
> computers.
DMD and LDC may be using different C libs to call printf. printf
may allocate, and thus overwrite the memory locations that you
freed. Undefined behavior doesn't mean it has to be random. ;)
-Johan
More information about the digitalmars-d-ldc
mailing list