memcpy() comparison: C, Rust, and D

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


On Thursday, 2 February 2017 at 16:44:26 UTC, Chris Wright wrote:
> On Thu, 02 Feb 2017 14:19:02 +0000, 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.
>
> Assuming you're writing cross-platform code. How common is 
> that? I write Java for a living, and some of my code only works 
> on Linux. (It does at least fail gracefully on OSX, which my 
> coworkers use.)

Ah, Java: write once, debug everywhere. :P

I almost always write cross-platform code. In C or C++, 
valgrind/asan will catch nearly all memory corruption problems on 
plain Linux. It's only weird corner cases that escape.

Which isn't to say you won't have Windows-only bugs, say. What 
I'm saying is if you read past the end of an allocated buffer you 
don't _need_ to test on all platforms. That'll be caught. i.e. 
the lack of valgrid on Windows or an embedded platform isn't a 
big deal.

Atila


More information about the Digitalmars-d mailing list