memcpy() comparison: C, Rust, and D

Atila Neves via Digitalmars-d digitalmars-d at puremagic.com
Fri Feb 3 04:10:55 PST 2017


On Thursday, 2 February 2017 at 20:50:58 UTC, Walter Bright wrote:
> On 2/2/2017 6:19 AM, Atila Neves wrote:
>> Also, unless you're testing possible bugs in compiler backends 
>> or the C standard
>> library, it mostly doesn't matter. Compile on regular 
>> x86/Linux and run
>> valgrind/asan there.
>
> I've often been able to flush out difficult bugs by compiling 
> on another platform.
>
> Back in the bad old DOS days, I quickly learned to develop the 
> programs on a protected mode operating system, then port to 16 
> bit real mode DOS as the last step. :-)

That I can see the value in. But (fortunately) those days are 
long gone.

>
>
>> Have I run into weird bugs that only occurred on one platform? 
>> Yes. Were they
>> _really_ rare? You betcha. *
>
> Memory corruption bugs show themselves differently on different 
> platforms, and one of them likely will make it easier to find 
> the bug.

Right, but we're talking about finding memory corruption bugs 
_before_ they manifest themselves. As I mentioned in my other 
reply, if you have memory corruption bugs in common 
cross-platform code, valgrind and asan will (nearly always) catch 
them. You don't need to wait for weird effects that are hard to 
trace back. Run on Linux with both valgrind and asan and you'll 
be fine 99.9%*  of the time.

Atila

* stats totally made up


More information about the Digitalmars-d mailing list